简体   繁体   English

jQuery的显示弹出里面弹出

[英]JQuery Displaying pop up inside pop up

I already have a JQuery function that creates a popup using an iframe. 我已经有一个使用iframe创建弹出窗口的JQuery函数。 A new requirements says I need to create another popup triggered from the first popup but the iframe doesn't allow me to create another popup. 一项新要求说,我需要创建从第一个弹出窗口触发的另一个弹出窗口,但是iframe不允许我创建另一个弹出窗口。 Is there anyway I can create a popup using the main page as a parent instead of an iframe? 无论如何,我可以使用主页作为父页面而不是iframe来创建弹出窗口吗? please if you have a better suggestion, let me know. 如果您有更好的建议,请告诉我。 thanks 谢谢

code: 码:

function GetPopUp ("../folder/file.htm", "POPUP Title")
 {
   var xpos = mouse_x;
   var ypos = mouse_y;
   var windowID = $(href.split('/')).last()[0].split('.')[0];
   var $dialog = $("#" + windowID)

   var dimensions = GetPopUpDimensions(windowID);

   $('body').after('<iframe id="' + windowID + '" style="padding:0;" src="' + href +  '">  </iframe>');
   $dialog = $("#" + windowID)
   $dialog.dialog(
   {
    autoOpen: false,
    title: title,
    position: 'center',
    sticky: false,
    width: dimensions.DialogWidth,
    height: dimensions.DialogHeight,
    draggable: true,
    resizable: false,
    modal: true,
    close: function () {
        $(this).dialog('destroy');
        $("#" + windowID).remove();
    }
});
$dialog.load(function () {
    $dialog.dialog('open');
    $dialog.css("width", "100%"); // reset the width that is set by jquery UI
});

} }

The htm file has a clickable link that is expected to trigger another popup htm文件具有一个可点击的链接,有望触发另一个弹出窗口

如果代码在iframe中执行,则可以为DOM选择器添加以下前缀:

window.parent.

The popup window will not apply to top of the IFrame window automatically, so we can easy to apply it through Parent.function_name(); 弹出窗口不会自动应用于IFrame窗口的顶部,因此我们可以轻松地通过Parent.function_name();来应用它。
function_name() => this function is defined top of the IFrame window. function_name()=>此函数在IFrame窗口的顶部定义。 You can see the full demo at below link 您可以在下面的链接中查看完整的演示

Click Here for demo 单击此处进行演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM