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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -