iFrame在jQuery UI中没有正确关闭 [英] iFrame Not Closing Properly In jQuery UI

查看:83
本文介绍了iFrame在jQuery UI中没有正确关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我通过jQuery UI在iFrame中设置了一个视频。在Firefox中,我没有任何问题,但对于IE和Chrome,尽管关闭了弹出对话框,音频仍在继续。



有没有办法解决这个问题? ?

谢谢。

 < script type =text /的javascript> 

函数openDialog(url){
$(< div class ='popupDialog'> Loading ...< / div>)
.dialog({
autoOpen:true,
closeOnEscape:true,
width:'900',
height:'900',
modal:true,
title: ''Bonus Features'
})。bind('dialogclose',function(){
jdialog.dialog('destroy');
})。load(url,function(){
$(this).dialog(option,position,['center','center']);
});

adjustJQueryDialogOverlay();


$(window).resize(function(){
$(。ui-dialog-content)。dialog(option,position, ['center','center']);
});
< / script>


解决方案

添加 beforeClose 到$删除元素的对话框:

  $(< div class ='popupDialog'> Loading ...< / div>)
.dialog({
autoOpen:true,
closeOnEscape:true,
width:'900',
height :'900',
modal:true,
title:'Bonus Features',
beforeClose:function(){$(this).remove();}
}) .load(url,function(){
$(this).dialog(option,position,['center','center']);
});


Right now, I have a video set up within an iFrame via jQuery UI. In Firefox I have no problems, but for IE and Chrome, the audio continues despite closing the pop-up dialog.

Is there a way around this in the jQuery UI code?

Thanks.

<script type="text/javascript">

    function openDialog(url) {
        $("<div class='popupDialog'>Loading...</div>")
            .dialog({
                autoOpen: true,
                closeOnEscape: true,
                width: '900',
                height: '900',
                modal: true,
                title: 'Bonus Features'
            }).bind('dialogclose', function() {
                jdialog.dialog('destroy');
            }).load(url, function() {
                $(this).dialog("option", "position", ['center', 'center'] );
            });

        adjustJQueryDialogOverlay();
    }

    $(window).resize(function() {
        $(".ui-dialog-content").dialog("option", "position", ['center', 'center']);
    });
</script>

解决方案

Add a beforeClose to the dialog to remove the element:

   $("<div class='popupDialog'>Loading...</div>")
        .dialog({
            autoOpen: true,
            closeOnEscape: true,
            width: '900',
            height: '900',
            modal: true,
            title: 'Bonus Features',
            beforeClose: function(){   $(this).remove();   }
        }).load(url, function() {
            $(this).dialog("option", "position", ['center', 'center'] );
        });

这篇关于iFrame在jQuery UI中没有正确关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆