I am currently attempting to make a dynamic website where as you scroll down it loads in more elements on the page.
html:
<div>some elements here</div>
<div id="page2"></div>
JavaScript:
var distance = $('part2').offset().top,
$window = $(window);
$window.scroll(function() {
if ( $window.scrollTop() >= distance ) {
$("#part2").append("pages/page2.html");
}
});
My problem is that it continues to refresh the page as the second element loads in. I need a way to make the second page load in and then stop to listen for scrolling. I do intend to later on implement a third part, so I will have another div for "page3" that will load in another page on scroll. Thanks a lot for help.