滚动一定的高度底色递增

$(window).scroll(function() {
    var swipeHeight = 200;//完全变色高度
    var scrollTop = $(document).scrollTop();//页面滚动高度
                
    var x = scrollTop/swipeHeight;
                
    $(".head-bg").css({"opacity":x});
})

 

posted @ 2018-03-07 11:53  诩小贝  阅读(118)  评论(0编辑  收藏  举报
Copyright ©2016 诩小贝   联系QQ:980823367