Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding sound to JQuery Cycle Plugin

Tags:

jquery

I am using the JQuery Plugin and would like to add sound for when my slideshow is going. I am using the shuffle effect and whenever it is to go to the next slide I would like a sound to be played.

$('#chars').cycle({
    fx:     'shuffle',
    prev:   '#prev',
    next:   '#next',
    timeout: 6000,
    speed:  800
});

jquery.malsup.com/cycle/ - That is the Plugin site.

These are the js files I am using.

Thanks a lot!

like image 676
CongdonJL Avatar asked Jul 10 '26 01:07

CongdonJL


1 Answers

Have a look at this previous question:

Cross-platform, cross-browser way to play sound from Javascript?

And use what you learn from that to play a sound from within Cycle's before and after callbacks, e.g.:

$('#chars').cycle({
    fx:     'shuffle',
    prev:   '#prev',
    next:   '#next',
    timeout: 6000,
    speed:  800,
    after: function() { soundPlay("vrooOOoom"); }
});
like image 62
karim79 Avatar answered Jul 11 '26 15:07

karim79



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!