Created
August 28, 2017 15:38
-
-
Save Dexdot/87c7bb9200c066de028b32c3c6401b42 to your computer and use it in GitHub Desktop.
sections load
This file contains hidden or 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
| $(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