Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

firefox stopping youtube video when expanding div

I am using jquery to expand a div with a youtube embed, but when I click to expand the div size firefox stops the youtube embed playing. Chrome, IE9 etc do not stop the video playing when expanding the size. I am hoping someone will know of a solution.

$(document).ready(function() {
    $("#wideView").click(function() {
        $("#youtube-movie").toggleClass("wide");
    });
});

Cheers

like image 806
Shannon Hyland Avatar asked Dec 18 '11 02:12

Shannon Hyland


1 Answers

If you are sure that the code in your OP is the only thing that's happening then it's because .wide dynamically changes overflow which causes a repaint of children elements in firefox. That means a flash player will reset and stop playing.

Demo here: http://jsfiddle.net/rVbQ6/2/ (Do it in firefox and you will see)

The solution is to remove any overflow manipulations.

like image 193
Esailija Avatar answered Nov 13 '22 03:11

Esailija