How to stop video when pressing back using jquery

I found a problem that in android(and also in some browsers) if i have video that playing and i press back button
the video will Continue to playing even if i move from the video page .
my solution is not the best but I have to compromise because I do not want to waste more time to find a better solution.
so the script :


<script>
        $(window).on('hashchange', function() {
            $("#videoOfOnePersonToShow").each(function () { this.pause() });
        });
</script>

this work Excellent But as you can see the script Happening if i move from any page to any page .
if you need the event will occur only from moving from page 2 to pag 1 for Example you need to find better solution.

Advertisements
This entry was posted in כללי and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s