firefox在扩展div时停止youtube视频

时间:2021-10-18 00:14:01

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.

我正在使用jquery来扩展一个带有youtube嵌入的div,但当我点击展开div大小时,firefox会停止youtube嵌入播放。 Chrome,IE9等在扩展尺寸时不会停止播放视频。我希望有人知道解决方案。

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

Cheers

干杯

1 个解决方案

#1


1  

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.

如果你确定你的OP中的代码是唯一发生的事情,那么因为.wide会动态地改变溢出,导致在firefox中重新绘制子元素。这意味着Flash播放器将重置并停止播放。

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

在这里演示:http://jsfiddle.net/rVbQ6/2/(在Firefox中做,你会看到)

The solution is to remove any overflow manipulations.

解决方案是删除任何溢出操作。

#1


1  

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.

如果你确定你的OP中的代码是唯一发生的事情,那么因为.wide会动态地改变溢出,导致在firefox中重新绘制子元素。这意味着Flash播放器将重置并停止播放。

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

在这里演示:http://jsfiddle.net/rVbQ6/2/(在Firefox中做,你会看到)

The solution is to remove any overflow manipulations.

解决方案是删除任何溢出操作。