Skip to content

Instantly share code, notes, and snippets.

@keeganbrown
Last active August 29, 2015 14:27
Show Gist options
  • Save keeganbrown/3a85977a76d11d6c2f8d to your computer and use it in GitHub Desktop.
Save keeganbrown/3a85977a76d11d6c2f8d to your computer and use it in GitHub Desktop.
master timeline scene skip
$(document).off('mousewheel');
var isScrolling = null;
$(document).on('mousewheel', function (e) {
if ( e.deltaY != 0 && Math.abs(e.deltaY) > 5 ) {
if ( !isScrolling ) {
$('video').each( function (i, ele) { ele.pause() } );
var _label = '';
if ( e.deltaY > 0 ) {
_label = master.getLabelBefore();
if ( !!_label ) {
master.seek(_label);
_label = master.getLabelBefore();
}
if ( _label == 'breakpoint1' ) {
master.seek(_label);
_label = master.getLabelBefore();
}
while ( !!_label && !_label.match(/breakpoint|start/gi) ) {
master.seek(_label);
_label = master.getLabelBefore();
}
console.log(_label);
} else if ( e.deltaY < 0 ) {
_label = master.getLabelAfter();
if ( !!_label && !_label.match(/breakpoint|start/gi) ) {
master.seek(_label);
_label = master.getLabelAfter();
}
}
if ( !!_label ) {
master.pause();
master.seek(_label);
if (_label != 'breakpoint1') {
master.play();
}
isScrolling = setTimeout( function () {
isScrolling = null;
master.play();
}, 1000 );
}
}
}
//console.log(e);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment