-
-
Save mersy/3af8f8c4aa7904e3f5c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ページ下までスクロールしたときにData APIで記事を取得 | |
var bottomLoad = ($("input[name='bottomLoad']").val() === "false") ? false : true; | |
$(window).on("scroll", function() { | |
var docHeight = $(document).height(); | |
var scrollPos = $(window).height() + $(window).scrollTop(); | |
// ページ下から50pxの範囲が表示されたら読み込み。loadFinishedがtrueの場合は読み込まない。 | |
if (bottomLoad && !loadFinished && (docHeight - scrollPos) < 50) { | |
bottomLoad = false; | |
params.offset = params.offset + params.limit; | |
getApiEntries (1, params, ""); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment