Created
November 27, 2009 10:41
-
-
Save mathiasbynens/243946 to your computer and use it in GitHub Desktop.
Playing sounds on mouseover using jQuery. Using <embed>, because who needs <audio> anyway‽
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 $sound = $('<div id="sound" />').appendTo('body'); | |
$('#special-links-that-play-annoying-sounds-when-hovered a').hover(function() { | |
$sound.html('<embed src="foo.mp3" hidden="true" autostart="true" loop="false">'); | |
}, function() { | |
// We could empty the innerHTML of $sound here, but that would only slow things down. | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment