2

ページのそれぞれの端に特定の近さに達すると、コンテンツがフェードインしようとしています。トリガーが一番上と一番下に設定されている場合、フェードは正常に機能しますが、距離 (200px) を設定すると、フェードが機能しなくなり、コンテンツが単に表示されます。

$(window).scroll(function(){
        if($(window).scrollTop()<=200){
            $('#about .content').stop(true,true).fadeIn("5s");
        } 
        else {
            $('#about .content').stop(true,true).fadeOut("10s");
        }

     if ($(window).scrollTop() + $(window).height() >= $(document).height() - 200) {
            $('#work .content').stop(true,true).fadeIn("5s");
        } else {
            $('#work .content').stop(true,true).fadeOut("5s");
        }
    });
4

1 に答える 1