jQuery实现跟随页面滚动的浮动层效果
2014-10-21 10:52
681 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jQuery实现跟随页面滚动的浮动层效果</title> <script type="text/javascript" src="/js/jquery-1.6.2.min.js"></script> <script type="text/javascript"> if ($.browser.version != "6.0") { $(window).scroll(function(){ if($(this).scrollTop()>118 &&(($(document).height()-$(this).scrollTop())>($(window).height()+$(".aysw-footer").innerHeight()))){ $("#c_left").css({position: 'fixed', top: '2px'}); }else{ if(($(document).height()-$(this).scrollTop())<=($(window).height()+$(".aysw-footer").innerHeight())){ $("#c_left").css({position: 'absolute', top:($(".aysw-footer").offset().top-$("#c_left").innerHeight()-$(".page-home").offset().top-20) +'px'}); }else{ $("#c_left").css({position: 'absolute', top: '2px'}); } } }); } </script> </head> <body style="height:auto; margin:0; padding:0"> <div style="height:118px;background:#6CF;"><br>所需js文件:<a href="/js/jquery-1.6.2.min.js" target="_blank">jquery-1.6.2.min.js</a><br><hr><p align="center"><font color=black>本特效由 <a href="http://www.hbycshop.com" target="_blank">亿诚</a>丨www.hbycshop.com 收集于互联网,只为兴趣与学习交流,不作商业用途。</font></p></div> <div class="page-home" style="min-height:1500px;width:100%; background-color:#FFC; position:relative"> <div id="c_left" style="border:1px solid red; width:200px ;height:800px; color:white;background-color:#333; position:absolute; top:2px"> 羞涩的浮动层... </div> </div> <div class="aysw-footer" style="height:200px; width:100%; background-color:#0C3; position:relative"></div> </body> </html>
相关文章推荐
- jQuery实现浮动层跟随页面滚动效果
- jQuery实现div浮动层跟随页面滚动效果
- jQuery实现div浮动层跟随页面滚动效果
- jQuery实现浮动层跟随页面滚动效果
- jQuery实现浮动层跟随页面滚动效果
- JQuery页面图片切换和新闻列表滚动效果的具体实现
- jQuery跟随浏览器滚动条浮动层效果
- 用 jQuery 实现页面滚动(Scroll)效果的完美方法
- jQuery实现页面滚动时层智能浮动定位
- JQuery实现页面企业广告图片切换和新闻列表滚动效果
- 页面滚动时层智能浮动定位,jQuery/MooTools实现
- 用 jQuery 实现页面滚动(Scroll)效果的完美方法
- 2011-01-16 21:13 JQuery实现页面随滚动条滚动而动态加载内容的效果
- js页面滚动浮动层智能定位(jQuery)实现
- js页面滚动时层智能浮动定位实现(jQuery/MooTools)
- jQuery实现页面滚动时层智能浮动定位实例探讨
- JQuery 实现的页面滚动时浮动窗口控件
- 【代码片段】jQuery实现页面滚动时层智能浮动定位-Fixed Floating Elements
- 用 jQuery 实现页面滚动(Scroll)效果
- js页面滚动时层智能浮动定位实现(jQuery)