這一定是一些愚蠢的錯誤,但在我的javascript函數中,當我到達屏幕底部時應該執行的if
表達式正在執行,當我到達屏幕頂部時... 這裏是我的代碼:當滾動到頂部而不是底部時添加元素
$(window).scroll(function() { //detect page scroll
if($(window).scrollTop() + $(window).height() == $(document).height()) //user scrolled to bottom of the page?
{
$('.animation_image').show(); //show loading image
}
});
.animation_image
是,當我到達屏幕的底部,當我回來到屏幕頂部向下滾動,然後應該出現,但出現一個加載圖片...
如果有人能解釋我做錯了什麼,那會很棒!
似乎是工作的罰款。 http://codepen.io/anon/pen/wKYqzz – Shikkediel
它似乎也適用於我。 $(document).height的價值是多少? – Bigalow
$(document).height value is 800 – Jackymamouth