如果滚动条到达底部,footer-nav 的透明度为1,否则为0.8;
html
<div class="footer-nav" id="footer"> <div class="fn-wrapper"> <a href=""> <img src="images/home.png"> <span>首页</span> </a> <a href=""> <img src="images/type.png"> <span>分类</span> </a> <a href=""> <img src="images/wechat.png"> <span>微信</span> </a> <a href=""> <img src="images/aipay.png"> <span>支付宝</span> </a> <a href=""> <img src="images/wifi.png"> <span>WIFI</span> </a> </div> </div>
jquery
function myScroll(id){ $(document).scroll(function(){ var d_height = $(document).height(); var s_top = $(document).scrollTop(); var w_height = $(window).height(); var _footer = $(id) if(s_top >= (d_height - w_height)){ _footer.css("opacity","1") }else{ _footer.css("opacity","0.8") } }) } myScroll("#footer");