I'm trying to recreate this effect: http://www.jam3.com/work/#mobilemusicvideo
All scrolling of the page is disabled until the animation of the top image completes. BUT, that image animation IS triggered when user attempts to scroll.
How can create this?
I am able to prevent scroll with this function:
function disableScroll() {
if (window.addEventListener) // older FF
window.addEventListener('DOMMouseScroll', preventDefault, false);
window.onwheel = preventDefault; // modern standard
window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE
window.ontouchmove = preventDefault; // mobile
document.onkeydown = preventDefaultForScrollKeys;
}
And re-enable it with this function:
enter code herefunction enableScroll() {
if (window.removeEventListener)
window.removeEventListener('DOMMouseScroll', preventDefault, false);
window.onmousewheel = document.onmousewheel = null;
window.onwheel = null;
window.ontouchmove = null;
document.onkeydown = null;
}
But if I first disable the scroll, how do I trigger a function when user attempts to scroll?