在Chrome/Safari中,Vimeo视频会在灯箱关闭后继续在后台播放。此时,“detach”会停止播放视频,但当您关闭Lightbox并单击某个菜单项以重新打开视频时,视频div将为空白。我试过“克隆”和“追加”,无法将视频恢复。jQuery detach div,追加div
网站功能: 点击“a”“b”“c”,灯箱出现在视频中。 单击灯箱中的“X”并关闭灯箱内容。
HTML/CSS
a id="alphaa" <------ The a, b, c menu item, when clicked, open the lightbox
.abcbox_content <------- The div that holds all the content for the lightbox
#videowrapper <------ div that holds the Vimeo iframe
.abc-align-right <---- the "X" to close the lightbox
这里是我到目前为止的jQuery。
<script type="text/javascript">
$(document).ready(function(){
$(".abc-align-right").click(function() {
$("#videowrapper").clone(true);
$("#videowrapper").contents().detach();
if ($(".abcbox_content").is(':visible'))
$("#videowrapper").append();
}); });
</script>
感谢所有帮助
感谢您的回复。这显示了视频,但将视频放在文本块的底部。也许引用错误的div? – Andrea 2012-03-03 02:01:46
也许吧。你可以尝试像'$(“#videowrapper”)。replaceWith($(“#videowrapper”)。clone(true));' – Malk 2012-03-03 02:05:50
我真的不知道是否需要所有其他的东西。换掉这些元素并称之为好。我编辑了我的答案。 – Malk 2012-03-03 02:14:46