jquery 底部导航透明度变化

如果滚动条到达底部,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");

  

posted @ 2015-10-23 10:16  BestSamCN  阅读(219)  评论(0编辑  收藏  举报