Hello.
I'm looking for a way to have infinite scrolling work both up and down. Presently the code below only works when you scroll down, meaning it shows the next html file, index3.html, when scrolling to the bottom. But let's say that my web page starts with index2.html, then I'd like to figure out how to go to index1.html when scrolling up.
index2.html
I'm looking for a way to have infinite scrolling work both up and down. Presently the code below only works when you scroll down, meaning it shows the next html file, index3.html, when scrolling to the bottom. But let's say that my web page starts with index2.html, then I'd like to figure out how to go to index1.html when scrolling up.
index2.html
HTML:
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link type="text/css" rel="stylesheet" media="all" href="style.css">
<script type="text/javascript" src="[URL unfurl="true"]https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>[/URL]
<script type="text/javascript" src="jquery.infinitescroll.js"></script>
<script type="text/javascript" src="manual-trigger.js"></script>
</head>
<body>
<div id="content">
<p>Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. </p>
<p>Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth. Lorum ipsum text andso forth.</p>
</div>
<a id="next" href="index3.html"></a>
<script type="text/javascript">
$(document).ready(function(){
$('#content').infinitescroll({
navSelector: "#next:last",
nextSelector: "#next:last",
itemSelector: "#content",
debug: false,
dataType: 'html',
maxPage: 2,
path: function(index) {
return "index" + index + ".html";
}
}, function(newElements, data, url){
});
});
</script>
</body>
</html>