Last active
November 8, 2016 21:44
-
-
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.
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
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe the scroll functions need to call
resetTimer()
when they start to fix the delay issue...