滚动一定的高度底色递增

$(window).scroll(function() {
    var swipeHeight = 200;//完全变色高度
    var scrollTop = $(document).scrollTop();//页面滚动高度
                
    var x = scrollTop/swipeHeight;
                
    $(".head-bg").css({"opacity":x});
})
原文地址:https://www.cnblogs.com/lhj-blog/p/8521525.html