Skip to content

Instantly share code, notes, and snippets.

@Dexdot
Created August 28, 2017 15:38
Show Gist options
  • Select an option

  • Save Dexdot/87c7bb9200c066de028b32c3c6401b42 to your computer and use it in GitHub Desktop.

Select an option

Save Dexdot/87c7bb9200c066de028b32c3c6401b42 to your computer and use it in GitHub Desktop.
sections load
$(function() {
var sectionHeight = $('#section-1').height(); // current section height
$(window).scroll(function(event) { // scroll event
var top = $(this).scrollTop(); // px from top
if (top == sectionHeight) { // when length from top equals current section height, we load new sections
$('.container').load('./sections.html #section-2'); // only second section
$('.container').load('./sections.html'); // or ALL section from section.html
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment