Vote count:
0
Description of Problem (Fiddle):
I'm attempting to iterate over all elements on a page and mute them with jQuery. Does jQuery just not play nice with HTML5 audio or is there a better approach?
Code:
$('#sound1').click(function() {
var sound1 = new Audio();
sound1.src = "http://ift.tt/O64Nhl"
sound1.play();
});
$('#sound2').click(function() {
var sound2 = new Audio();
sound2.src = "http://ift.tt/1fbgYV4"
sound2.play();
});
$('#mute').click(function() {
$('audio').each(function(i) {
this.volume = 0;
});
});
asked 47 secs ago
Aucun commentaire:
Enregistrer un commentaire