首页 > 其他 > 详细

滚动到顶部固定

时间:2018-07-05 11:54:02      阅读:157      评论:0      收藏:0      [点我收藏+]
 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     });

 

滚动到顶部固定

原文:https://www.cnblogs.com/yangguoe/p/9267397.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!