zoukankan      html  css  js  c++  java
  • 滚动到顶部固定

     1     // 滚动到顶部固定
     2     var navH = $(".fixedTop").offset().top;
     3     $(".fixedTop").wrap("<div class='background-fixed'></div>");
     4     $('.flowDev').scroll(function () {
     5         var scroH = $('.flowDev').scrollTop();
     6         if (scroH >= navH) {
     7             $(".fixedTop").css({"position": "fixed", "top": 0});
     8             $(".fixedTop").css({"z-index": "999"});
     9             $(".fixedTop").css({"background": "#f4f4f4"});
    10             $(".fixedTop").css({"width": "94%"});
    11         } else if (scroH < navH) {
    12             $(".fixedTop").css({"position": "static"});
    13             $(".fixedTop").css({"background": "#fff"});
    14             $(".fixedTop").css({"width": "100%"});
    15         }
    16     });
  • 相关阅读:
    豆豆
    艺术家
    姐姐
    书名与歌名
    MySQL
    杂文
    武侠
    青年诗人
    那些歌
    传世
  • 原文地址:https://www.cnblogs.com/yangguoe/p/9267397.html
Copyright © 2011-2022 走看看