Last active
August 29, 2015 14:27
-
-
Save keeganbrown/f59f7065163f61e40a26 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 scrubpoint = 0; | |
var isScrolling = null; | |
$(document).on('mousewheel', function (e) { | |
e.preventDefault(); | |
if ( e.deltaY != 0 && Math.abs(e.deltaY) > 5 ) { | |
if ( !isScrolling ) { | |
$('video').each( function (i, ele) { ele.pause() } ); | |
} | |
master.pause(); | |
scrubpoint = ( e.deltaY / Math.abs(e.deltaY) ); | |
if ( !!isScrolling ) { | |
clearTimeout( isScrolling ); | |
isScrolling = null; | |
} | |
isScrolling = setTimeout( function () { | |
isScrolling = null; | |
master.play(); | |
scrubpoint = 0; | |
}, 500 ); | |
} | |
//console.log(e); | |
}); | |
TweenMax.ticker.addEventListener('tick', function () { | |
var scrollmod = scrubpoint / -10; | |
if ( isScrolling && master.time() + scrollmod > 0.01 && master.time() + scrollmod < master.duration() - 0.01 ) { | |
master.seek( master.time() + scrollmod ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment