kolber / audiojs

A cross-browser javascript wrapper for the html5 audio tag
http://kolber.github.io/audiojs
MIT License
2.11k stars 438 forks source link

Problem with lightbox #119

Open sagarquad opened 11 years ago

sagarquad commented 11 years ago

I used this excellent plugin.Currently I open audio player in lightbox. I Have query to ask you how to stop playing song when lightbox close button is clicked.

WaltHubbb commented 9 years ago

I searched for a few hours and solved the problem with this jquery-code:

$('.the-lightbox-close-button').click(function(e) { $('audio').each(function(){ this.pause(); // Stop playing this.currentTime = 0; // Reset time }); });

This code stops all audio on the site. Just change the "the-lightbox-close-button" to the class of the closebutton of your lightbox.