Thanks for the suggestions. Now I consider this plugin: http://www.happyworm.com/jquery/jplayer/
On Sep 25, 3:33 am, Magnitus <eric_vallee2...@yahoo.ca> wrote: > Assuming that you know how to create sound effects in regular > Javascript, making your own pluggin for it doesn't seem that > difficult. > > Lets assume that you want a pluggin that affect only div elements in a > wrapped set and you want to be able to specify the sound... > > It'd look something like this (note that this is a quick-and-dirty > piece of code... totally untested): > > {function($){ > $.fn.AddSoundOnClick = function(SoundEffect) { > return this.filter('div').bind('click',function(event){ > //Stick the logic to emit the sound effect here > }).end(); > }; > > })(jQuery); > > Afterwards, lets say that you have a sound effect stored in the > variable CowSound and a div with class "SoundDiv", you could add the > cow sound like this: > > jQuery('div.SoundDiv').AddSoundOnClick(CowSound); > > Here's terrific book for jQuery: > > http://www.amazon.ca/jQuery-Action-Second-Bear-Bibeault/dp/1935182323... > > If you're serious about using jQuery properly, it'll be the best 30$ > you ever spent. Sure learned a lot from it. > > On Sep 24, 4:13 pm, Rick <sababa.sab...@gmail.com> wrote: > > > > > Hi, > > > I'd like to make a button that generates a sound when clicking on it. > > This JQuery plugin was the best way I could > > found:http://plugins.jquery.com/project/sound > > and I wrote this code: > > > views/default/index.html: > > {{extend 'layout.html'}} > > <div> > > onClick="jQuery(this).sound.play(/static/success.wav)" > > </div> > > > views/layout.html: > > <head> > > > {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}} > > </head> > > > Since I'm totally new to JQuery I understand that this is completely > > wrong. Could anyone tell me how it should look like, please?