|
|
Forum moderator: bigblog |
uCoz Community For Webmasters Custom Solutions hover sound (?????) |
hover sound |
ok i want to add sound to my menu ,,like when mouse hover on it it produces sound(click etc).
and when i click on one of menu then it also plys sound (tick etc) i know their is a way that i will make a flash .swf etc but is their any other way? the quieter you become, the more you are able to hear.
|
angry_jin, if you want different sound for each menu item, paste this line to the Bottom part of website template:
Code <span id="sound"></span> <script type="text/javascript">function hoversnd(f) {document.getElementById("sound").innerHTML='<audio autoplay="1"><source src="' + f + '" type="audio/wav"></audio>';}</div> And for menu, an item will be like this: Code <a href="#" onmouseover="hoversnd('http://bigblog.ucoz.net/src/Alarm08.wav');">Item text</a> (Replace http://bigblog.ucoz.net/src/Alarm08.wav with your sound file's URL address). If you want just one sound for every menu item, paste this line to the Bottom part of website template: Code <span id="sound"></span> <script type="text/javascript">function hoversnd() {document.getElementById("sound").innerHTML='<audio autoplay="1"> <source src="http://bigblog.ucoz.net/src/Alarm08.wav" type="audio/wav"></audio>';}</div> (Replace http://bigblog.ucoz.net/src/Alarm08.wav with your sound file's URL address). And for menu, an item will be like this: Code <a href="#" onmouseover="hoversnd();">Item text</a> For playing after clicking, replace onmouseover with onclick at the menu element. Note: This code plays a .wav file. If you want to play an .mp3 file, replace wav with mpeg in the code from the Bottom part of website template. Demo: Fiddle. hey i'm joe and i do not work for the company anymore, please contact other staff or tech support
icon by ch-chau sometimes i lurk here |
have a look i m talking about this,bigblog,
Attachments:
9243702.jpg
(235.0 Kb)
the quieter you become, the more you are able to hear.
|
angry_jin, I just figured out, that I wrote </div> instead of </script> in the code from the bottom part.
Well, if you are using a standard menu (generated by system), you have to put the menu code ($SMENU_X$/$NMENU_X$) inside of: Code <div id="menusnd"> and </div> And you have to use this code for the bottom part: Code <span id="sound"></span> <script type="text/javascript">function hoversnd(){ document.getElementById("sound").innerHTML='<audio autoplay="1"> <source src="http://bigblog.ucoz.net/src/Alarm08.wav" type="audio/wav"></audio>'; } var menusnd = document.getElementById("menusnd"); var a = menusnd.getElementsByTagName("a"); for(var i=0; i<a.length; i++) { a[i].addEventListener("mouseover", hoversnd); }</script> (JavaScript code fixed by vmarci21) hey i'm joe and i do not work for the company anymore, please contact other staff or tech support
icon by ch-chau sometimes i lurk here |
| |||
| |||