Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flash video still playing on DIV that is removed using jQuery (IE bug)

Tags:

jquery

css

flash

I have some jQuery tabs one of which holds a flash video. When I play the video in one tab and click to another in FF or Safari the video stops along with the sound, clicking back to the video tab reloads the content - as expected.

In Internet Explorer this is not the case, the video continues to play even when the tab is not selected. My understanding is that when display:none (jQuery hide()) is applied the DOM element is essentially removed from layout - why is this not happening with IE browsers, how can I fix it?

like image 949
Simon Avatar asked Nov 26 '09 22:11

Simon


5 Answers

To remove the video and then re-add it, add the following to your function that closes the video window:

 // Remove and re-add video
 var clone = $("#video-holder").clone(true);
 $("#video-holder").remove();
 $("#video").html(clone);

Where you have a surrounding "video" div, and inside a "video-holder" div that houses the embed code.

like image 83
Marlon Creative Avatar answered Oct 21 '22 06:10

Marlon Creative


You could try removing the element when you are tabbing away from the div containing the flash like $("object").remove();

like image 29
Divya Manian Avatar answered Oct 21 '22 04:10

Divya Manian


Simply do like this to refresh :

var a = document.getElementById('div_movie').innerHTML;
document.getElementById('div_movie').innerHTML = a;
like image 25
david Avatar answered Oct 21 '22 06:10

david


$("#VideoContainer").html("");

Seemed to be the right answer, but if I click the same element twice it stays empty.

like image 45
Alex Avatar answered Oct 21 '22 04:10

Alex


simply clear the container of the video like this:

$("#VideoContainer").html("");

like image 38
BuKToP Avatar answered Oct 21 '22 06:10

BuKToP