How do I implement jquery.sound.js?
I want a button to make a blip sound when moused over.
I want to use jquery.sound.js
I found this above plugin and I like jquery. But I can find NO documentation on how to employ it.
I understand from another half-assed answer to this same question that sound.js configures 开发者_高级运维itself according to the file url you supply...(?)
But where does one write in the url?
What kind of element do I make for it? A span? A division? What must its id be?
Also, if the embed element is injected dynamically, how is one supposed to see it to write in the URL?
Like 95% of "help" I search for, the answer I found was totally useless for a person not used to using jquery plugins.
People: If you enjoy others, that's fantastic. Just please do a thorough job of it or it just frustrates and wastes people's time as they have to start over with yet another search... Sometimes it takes me six different websites before I get an understandable answer that includes an example of how to write the HTML, javascript or whatever.
You mean to say you are novice to javascript
and jQuery
? Here is a simple steps to play a sound...
Include jQuery.js
and jquery.sound.js
.
Here is one way to play the sound from a url
$.sound.play(url)
Other options from documention
/**
* API Documentation
*
* // play a sound from the url
* $.sound.play(url)
*
* // play a sound from the url, on a track, stopping any sound already running on that track
* $.sound.play(url, {
* track: "track1"
* });
*
* // increase the timeout to four seconds before removing the sound object from the dom for longer sounds
* $.sound.play(url, {
* timeout: 4000
* });
*
* // stop a sound by removing the element returned by play
* var sound = $.sound.play(url);
* sound.remove();
*
* // disable playing sounds
* $.sound.enabled = false;
*
* // enable playing sounds
* $.sound.enabled = true
*/
Here is the source code to understand
http://code.google.com/p/jqueryjs/source/browse/trunk/plugins/sound/jquery.sound.js?r=5750
精彩评论