ajax - SoundCloud: how to stop playing when hash change -


i'm using ajax page switching method soundcloud script.

how stop playing music when user leaves page soundcloud container?

i've found these stokes:

// stop players, might useful, before replacing player dynamically   $.scplayer.stopall = function() {     $('.sc-player.playing a.sc-pause').click();   }; 

currently call initialization $(".sc-player").scplayer(); inside .load function, need put code stop playing audio before page switching?

you can add event listener window.onhashchange = stopall;

and definition of stopall() be

stopall = function() { $('.sc-player.playing a.sc-pause').click(); };


Comments

Popular posts from this blog

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -