Created
September 26, 2011 20:32
-
-
Save thebinarypenguin/1243317 to your computer and use it in GitHub Desktop.
Simple jQuery Infinite Scroll
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Simple jQuery Infinite Scroll</title> | |
</head> | |
<body> | |
<h1>One</h1> | |
<br /> | |
<h1>Two</h1> | |
<br /> | |
<h1>Three</h1> | |
<br /> | |
<h1>Four</h1> | |
<br /> | |
<h1>Five</h1> | |
<br /> | |
<h1>Six</h1> | |
<br /> | |
<h1>Seven</h1> | |
<br /> | |
<h1>Eight</h1> | |
<br /> | |
<h1>Nine</h1> | |
<br /> | |
<h1>Ten</h1> | |
<br /> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | |
<script> | |
$(function() { | |
$(window).scroll(function () { | |
var theWindow = $(this); | |
var theContainer = $('body'); | |
var tweak = 10; | |
if ( theWindow.scrollTop() >= theContainer.height() - theWindow.height() - tweak ) { | |
theContainer.append('<h1>One More</h1><br />'); | |
} | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment