Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Examples of two onStateChange events
// listen for when the viewer decides to start playing the video
// hide the intro & outro text divs as well as "lower the lights"
YTVideo.on('playing', function() {
document.getElementById('intro').setAttribute('class', 'text hide');
document.getElementById('outro').setAttribute('class', 'text hide');
document.getElementById('lights').setAttribute('class', 'darken');
// listen for when the video ends
// show the outro text div as well as "bring up the lights"
YTVideo.on('ended', function() {
document.getElementById('outro').setAttribute('class', 'text show');
document.getElementById('lights').setAttribute('class', 'lighten');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment