Show div after scrolling 100px from the top of the page

后端 未结 3 639
广开言路
广开言路 2020-12-14 19:41

I found this, but this does it 100px before the bottom of the page. I need it 100px from the top of the page. I know how to implement it, I\'ve done other jquery animations,

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-14 20:17

    Try this:

    $(window).scroll(function() {
        if ($(window).scrollTop() > 100) {
            // > 100px from top - show div
        }
        else {
            // <= 100px from top - hide div
        }
    });
    

提交回复
热议问题