• fixed


     1 !(function(){
     2     $.fn.affix = function(options){
     3         var defualtOption = {
     4             top:0,
     5             container:$("html, body"),
     6             bottom:0
     7         }
     8         var option = $.extend( defualtOption, options);
     9         var offsetTop = $(this).offset().top;
    10         var height = option.container.height();
    11         var cOffsetTop = option.container.offset().top;
    12         var limmit = height + cOffsetTop - option.bottom;
    13         var _this = this;
    14         $(window).on("scroll",function(){
    15             var scorllTop = $(window).scrollTop();
    16             console.log("dddd")
    17             console.log(offsetTop)
    18             console.log(scorllTop + cOffsetTop)
    19             if(offsetTop < scorllTop  && scorllTop < limmit){
    20                 if(window.XMLHttpRequest){
    21                     $(_this).css({
    22                         position:"fixed",
    23                         top:0
    24                     })
    25                 }else{
    26                     $(_this).css({
    27                         position:"absolute",
    28                         top: offsetTop - scorllTop
    29                     })
    30                 }
    31             }else{
    32                 $(_this).css({
    33                     position:"static"
    34                 })
    35             }
    36         })
    37     }
    38 })(jQuery)
  • 相关阅读:
    f5版本升级
    f5申请并激活License
    f5时间设置
    f5 SNMP配置
    f5 Syslog管理
    f5单台安装配置
    f5负载均衡算法
    f5 Seldom used
    f5售后查询
    f5基本介绍
  • 原文地址:https://www.cnblogs.com/yanypan/p/3687119.html
Copyright © 2020-2023  润新知