Skip to content

Instantly share code, notes, and snippets.

@hodduc
Last active August 29, 2015 14:03
Show Gist options
  • Save hodduc/36b692c426f0d174e24f to your computer and use it in GitHub Desktop.
Save hodduc/36b692c426f0d174e24f to your computer and use it in GitHub Desktop.
Auto Page Scroller (Tested on Chrome)
var body = document.body,
html = document.documentElement;
var pos=0;
window.setInterval(function(){
var height = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight );
console.log("reload");
pos += window.innerHeight || document.body.clientHeight;
if (pos>height) location.reload();
$("body").animate({scrollTop: pos}, '300');
}, 10000);
javascript:var jq = document.createElement('script');jq.src = "//code.jquery.com/jquery-latest.min.js";jq.onload=function(){$.getScript("https://rawgit.com/hodduc/36b692c426f0d174e24f/raw/4098ca1c484c7e4db8387b0becdae7494485915f/scroll.js");};document.getElementsByTagName('head')[0].appendChild(jq);if(jQuery){jQuery.noConflict();};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment