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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -