javascript - scroll scrolling issue
过去多啦不再A梦
过去多啦不再A梦 2017-06-26 10:55:45
0
4
814

1, https://www.kayak.com.hk/holi... The main effect is the effect of this website.

When sliding the scroll bar, the p on the right will scroll down, and the p on the left will also scroll accordingly. But since the p on the left is too long, the top part needs to be hidden, and this effect is achieved.
When scrolling up, you need to hide the lower part of the p on the left, which is mainly stuck here. I have tried a method, which is to judge the position of the front and rear scroll bars for display. The effect is OK, but the page is stuck, which should be caused by judging the front and rear scroll bars multiple times. . Here is the code:

if($(window).height() > 550){

var top  = 240;                    
if($(document).scrollTop() > top){
    var beforeScroll=$(document).scrollTop();
    var topIframe = -180;
    $("#SearchPackageLeftp").css({"position": "fixed","top": topIframe});
    $(window).scroll(function(){
        var afterScroll=$(document).scrollTop();
        var result=afterScroll-beforeScroll;
            if(result<0){
            var downIframe=10;
            $("#SearchPackageLeftp").css({"position": "fixed","top":downIframe});
        }
            beforeScroll=afterScroll;
    });
}else{
    $("#SearchPackageLeftp").css({"position": "relative","top": "0px"});
    }
}

Please explain. . Been stuck for a day. . . . . Be online at any time, if you don’t understand I can explain it in detail. . Thank you everyone

过去多啦不再A梦
过去多啦不再A梦

reply all(4)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!