开发者

Jquery: How do I fire/play a sound file when I want?

I have some code that basically inflates a 'balloon' through 15 or so stages and then makes it pop at the 16th stage. (yes, images are changed). What I'm wondering now is if it's possible to use Jquery to play a sound file whenever I reach that 16th stage (or when whatever var reaches whatever value) - in开发者_Python百科 other words...when I want.

I've found several jquery sound plugins but they all create this player which I must then click for it to play the file. How do I skip that 'click' part so that the sound is just...directly/automatically played?

http://www.sean-o.com/jquery/jmp3/

http://www.happyworm.com/jquery/jplayer/

All help is appreciated G.Campos


Hrmm...seems like no one bothered to check here :o

The answer to my question turned out to be simple:

1.- Loading the player:

// load mp3 player with autoplay on
$(".mp3").jmp3();

2.- Modifying jsmp3.js where it reads:

"autoplay": "false" ---> change it to "true"

The rest was just hiding the player.

Oh well, congrats to...myself


seems like directly using HTML embed would work just as well

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜