wagerfield/parallax

Disabling Script when window is not active

mooseknuckleking opened this issue · 1 comments

How would I use event listeners to disable this script when the window is not the focus? And re-run the script when the window becomes active? I guess a more accurate would even be to reset the animation each time the window comes back into focus. I know the configuration option "HoverOnly" works for a desktop, but I cannot seem to get it working on a mobile (no cursor) which is why I've thought of this solution.

This is what I have added so far
<script type='text/javascript'> var count = 0; var myInterval; // Active window.addEventListener('focus', startTimer); // Inactive window.addEventListener('blur', stopTimer); </script>