Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I made a small fix to your jquery-autoload fork #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions jquery.autopager-too.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* jQuery.autopager Too v1.0.1
* jQuery.autopager Too v1.0.2
*
* Copyright (c) cristinawithout
* Based on jQuery.autopager copyright (c) Lagos
Expand All @@ -16,7 +16,7 @@
*/
(function($) {
var window = this, options = {},
content, currentUrl, nextUrl,
content = null, currentUrl = null, nextUrl = null,
active = false,
defaults = {
autoLoad: true,
Expand Down Expand Up @@ -125,12 +125,12 @@
if (value) {
options.appendTo = null;
}
break
break;
case 'appendTo':
if (value) {
options.insertBefore = null;
}
break
break;
}
options[key] = value;
}
Expand All @@ -141,8 +141,10 @@
}

function loadOnScroll() {
// Checks the current location of the viewport on the page. If it's within 20 pixels of the bottom,
// load the next page.
var height = window.innerHeight ? window.innerHeight : $(window).height();
if (content.offset().top + content.height() < $(document).scrollTop() + height) {
if (content.offset().top + content.height() < $(document).scrollTop() + height + 20) {
$.autopager.load();
}
}
Expand Down