Play Sound On Hover

A script that will play a sound when you hover over certain elements on the page.

About This Script

To use this, copy the script from below to the <head> tag of your page. Then add the "hoverSound" class to any element you want this to apply to, and the data-sound="" attribute.


Hover over an image to hear the sound.


<!-- jQuery is required if you're not already using it --> <script src="//"></script> <script> $(function(){ $('.hoverSound').hover(function(){ if ($(this).data('audioElement')) { $(this).data('audioElement').play(); } else { var sound = $(this).attr('data-sound'); var audioElement = document.createElement('audio'); audioElement.setAttribute('src', sound); audioElement.setAttribute('autoplay', 'autoplay'); $(this).data('audioElement', audioElement); } }, function(){ $(this).data('audioElement').pause(); $(this).data('audioElement').currentTime = 0; }); }); </script> <!-- Examples. You don't need to copy this part. --> <img class="hoverSound" src="" data-sound="" /> <img class="hoverSound" src="" data-sound="" />
More scripts

Do you want to expose your site to millions?
Do you want to be ranked higher in Google?
Do you want to be known as the best site in your niche?

Then look no further. Add your site in 3 simple steps. Sign up, Add your site and Start receiving votes! It only takes 10 seconds!

Sign Up to Top Site List Planet Now!

Login with one of these social networks...

Sign in with FacebookSign in with TwitterSign in with Google+Sign in with Yahoo!Sign in with LinkedIn

or create an account with your email...

Login To An Existing Account