Last active
May 18, 2017 01:35
-
-
Save dbarria/456e52fdb07e1dc4b8e0407807896e12 to your computer and use it in GitHub Desktop.
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
$.finishScroll = false; | |
$.scrollFullPage = function() { | |
var scroll = 0; | |
var time = 0; | |
var body = document.body, | |
html = document.documentElement; | |
var realHeight = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); | |
while(scroll < realHeight){ | |
time = time + 1600; | |
scroll = scroll + $(window).height(); | |
(function(scroll, time){ | |
setTimeout(function() { | |
console.log($.finishScroll); | |
$.smoothScroll({ | |
speed: 800, | |
afterScroll: function() { | |
if(scroll >= realHeight){ | |
$.finishScroll = true; | |
} | |
} | |
},'+=' + $(window).height()) | |
}, time); | |
})(scroll, time); | |
} | |
} | |
$.scrollFullPage(); | |
$.finishScroll |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment