0
我能夠加載我的ajax當滾動到底部時,我想弄清楚如何修改下面的代碼片段,以便它只在窗口滾動時才起作用到頂部?JQuery窗口滾動頂部和底部
$(window).scroll(function() {
if ($(document).height() <= $(window).scrollTop() + $(window).height()) {
//this works here for scrolling bottom
}
else if ($(document).height() >= $(window).scrollTop() + $(window).height()){
//i tried checking for greater than the window scroll but that didn't owrk
}
});
這不會解決問題,爲的$(document).height()總是會在這種情況下,最大或同等價值與增加的其他數值相比。所以問題在於if-else-if的條件。 –