Skip to content

Instantly share code, notes, and snippets.

@alanmoo
Last active November 8, 2016 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanmoo/4b47aad61a2e661bdac700ada5884a5a to your computer and use it in GitHub Desktop.
Save alanmoo/4b47aad61a2e661bdac700ada5884a5a to your computer and use it in GitHub Desktop.
Use with Custom Style Script Firefox Add-on to enable demo mode on network pulse.
var timer;
var idleTimeInMinutes = 1
var scrollDownTime = 4
var scrollUpTime = 0.25
function scrollToBottom(){
console.log('scroll');
$('#latest-view-link').click();
$('html, body').animate({
scrollTop: $('.projects').height()
}, scrollDownTime*60000 , "linear", scrollToTop);
}
function scrollToTop(){
$('html,body').animate({
scrollTop: 0
}, scrollUpTime*60000 , scrollToBottom);
}
window.addEventListener('DOMContentLoaded', function(){
$(this).mousemove(resetTimer);
$(this).keypress(resetTimer);
resetTimer();
});
function resetTimer() {
window.clearTimeout(timer);
$('html,body').stop();
timer = window.setTimeout(scrollToBottom, idleTimeInMinutes*60000);
}
@alanmoo
Copy link
Author

alanmoo commented Nov 8, 2016

Maybe the scroll functions need to call resetTimer() when they start to fix the delay issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment