Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Can';不要打开多次jquery对话框_Php_Javascript_Jquery_Html_Ajax - Fatal编程技术网

Php Can';不要打开多次jquery对话框

Php Can';不要打开多次jquery对话框,php,javascript,jquery,html,ajax,Php,Javascript,Jquery,Html,Ajax,我有一个jquery对话框,其中包括: $(document).ready(function() { if( window.location.href.indexOf( '#product' ) != -1 ) { var productID = window.location.href.split('-'); showDialog(productID[1]); } }); function showDialog(productID) { $( "#dialog-mo

我有一个jquery对话框,其中包括:

$(document).ready(function() {
if( window.location.href.indexOf( '#product' ) != -1 ) {
    var productID = window.location.href.split('-');
    showDialog(productID[1]);
}

});

function showDialog(productID)
{
    $( "#dialog-modal_"+productID ).html( "<iframe src='index.php?act=showProduct&amp;id="+productID+"' width='100%' height='100%' frameborder='0' scrolling='no'></iframe>" );
    $( "#dialog-modal_"+productID ).dialog({
    width: 790,
    height: 590,
    modal: true,
    open: function(event, ui)
    {

    }
    });

}
$(文档).ready(函数(){
if(window.location.href.indexOf(“#product”)!=-1){
var productID=window.location.href.split('-');
showDialog(productID[1]);
}
});
函数showDialog(productID)
{
$(“#dialog-modal"+productID).html(“”);
$(“#dialog-modal”+productID).dialog({
宽度:790,
身高:590,
莫代尔:是的,
打开:功能(事件、用户界面)
{
}
});
}
当我打开它时,它工作正常,但如果我关闭窗口并尝试重新打开它,它就没有响应


谢谢

下面是jQuery UI对话框代码应该如何显示的示例。记住,您需要一种打开对话框的方法。因此,创建一个函数,再次在该模式上调用
showDialog
。一个按钮或链接就可以了

jQuery用户界面代码

function showDialog(productID)
{
    var container = $('#dialog-modal_'+productID).html('<blah blah>');
    container.dialog({
        autoOpen: false,
        modal: true,
        width: 790,
        height: 590
    });
    container
        .dialog('option', 'title', 'Your Title')
        .dialog('option', 'buttons', {
            Close: function() {
                $(this).dialog('close');
            }
        })
        .dialog('open');
        //do open event work here
}
函数显示对话框(productID)
{
var container=$('#dialog-modal'+productID).html('');
容器对话框({
自动打开:错误,
莫代尔:是的,
宽度:790,
身高:590
});
容器
.dialog('选项','标题','您的标题')
.dialog('选项','按钮'{
关闭:函数(){
$(this.dialog('close');
}
})
.对话框(“打开”);
//在这里做公开活动吗
}
DOM用于打开按钮

<a href="#null" id="open">Open My Modal</a>
$('a#open').click(function(e) {
    e.preventDefault();
    showDialog(<your id>);
});

jQuery用于打开按钮

<a href="#null" id="open">Open My Modal</a>
$('a#open').click(function(e) {
    e.preventDefault();
    showDialog(<your id>);
});
$('a#open')。单击(函数(e){
e、 预防默认值();
showDialog();
});

下面是jQuery UI对话框代码应该如何显示的示例。记住,您需要一种打开对话框的方法。因此,创建一个函数,再次在该模式上调用
showDialog
。一个按钮或链接就可以了

jQuery用户界面代码

function showDialog(productID)
{
    var container = $('#dialog-modal_'+productID).html('<blah blah>');
    container.dialog({
        autoOpen: false,
        modal: true,
        width: 790,
        height: 590
    });
    container
        .dialog('option', 'title', 'Your Title')
        .dialog('option', 'buttons', {
            Close: function() {
                $(this).dialog('close');
            }
        })
        .dialog('open');
        //do open event work here
}
函数显示对话框(productID)
{
var container=$('#dialog-modal'+productID).html('');
容器对话框({
自动打开:错误,
莫代尔:是的,
宽度:790,
身高:590
});
容器
.dialog('选项','标题','您的标题')
.dialog('选项','按钮'{
关闭:函数(){
$(this.dialog('close');
}
})
.对话框(“打开”);
//在这里做公开活动吗
}
DOM用于打开按钮

<a href="#null" id="open">Open My Modal</a>
$('a#open').click(function(e) {
    e.preventDefault();
    showDialog(<your id>);
});

jQuery用于打开按钮

<a href="#null" id="open">Open My Modal</a>
$('a#open').click(function(e) {
    e.preventDefault();
    showDialog(<your id>);
});
$('a#open')。单击(函数(e){
e、 预防默认值();
showDialog();
});

无法重新打开对话框,因为它是在
$(文档)期间打开的。准备好了
并且不再使用任何其他代码来打开它。请使用
window.location.href
而不是
window.location.hash
。无法重新打开对话框,因为它是在
$(文档)期间打开的.ready
并且不再使用任何其他代码再次打开它。请使用
window.location.href
而不是
window.location.hash