Created
February 21, 2012 03:39
-
-
Save imakewebthings/1873472 to your computer and use it in GitHub Desktop.
Background audio for each slide in deck.js
This file contains 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
/* Plays all audio elements inside a slide when the slide becomes active | |
and pauses them when the user navigates away. Replace pause with | |
whatever functionality desired (maybe pause and set currentTime to 0?) */ | |
$(document).bind('deck.change', function(e, from, to) { | |
$.deck('getSlide', from).find('audio').each(function() { | |
this.pause && this.pause(); | |
}); | |
$.deck('getSlide', to).find('audio').each(function() { | |
this.play && this.play(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment