在 jquery.simplemodal 中使用 iframe,当弹出窗口关闭时 iframe 会重新加载

发布于 2024-08-24 06:29:45 字数 516 浏览 4 评论 0原文

var pt_popup_options = {};

function pt_popup_iframe(sURL, sOkFunction)
{
    pt_popup_okfunction = sOkFunction;
    $("#pt_msgBox").css('width', '700px');
    $("#pt_msgBox").css('heigth', '500px');
    $("#pt_msgBox > p").html('<iframe style="width: 696px; height: 496px;" src="' + sURL + '"></iframe>');
    $("#pt_msgBox").modal(pt_popup_options);
}

当通过关闭按钮或弹出窗口右上角的“x”关闭弹出窗口时,iframe 会重新加载并向服务器发出请求。它不应该这样做。有什么想法可以防止这种情况发生吗?我使用的是 Chrome 和 jQuery 1.4.2。

谢谢你!

var pt_popup_options = {};

function pt_popup_iframe(sURL, sOkFunction)
{
    pt_popup_okfunction = sOkFunction;
    $("#pt_msgBox").css('width', '700px');
    $("#pt_msgBox").css('heigth', '500px');
    $("#pt_msgBox > p").html('<iframe style="width: 696px; height: 496px;" src="' + sURL + '"></iframe>');
    $("#pt_msgBox").modal(pt_popup_options);
}

When the popup is closed via a close button or the "x" top right of the popup, the iframe reloads and make a request to the server. It is not supposed to do that. Any idea to prevent that? I'm on Chrome and jQuery 1.4.2.

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

嘿哥们儿 2024-08-31 06:29:45

我也有同样的问题。

修复此问题的最简单方法是设置 persist 选项。

$("#pt_msgBox").modal({persist:true});

从 simplemodal-1.3.5 开始

persist:(布尔值:false)跨模式调用保留数据?仅有的
用于现有 DOM 元素。如果为真,数据将被保留
跨模态调用,如果为 false,数据将恢复为其
原始状态。

I had the same problem.

Easiest way to fix it is to set the persist option.

$("#pt_msgBox").modal({persist:true});

As of simplemodal-1.3.5

persist: (Boolean:false) Persist the data across modal calls? Only
used for existing DOM elements. If true, the data will be maintained
across modal calls, if false, the data will be reverted to its
original state.

优雅的叶子 2024-08-31 06:29:45

如果您使用 jQueryUI 的对话框,还有另一种选择,我不久前编写了一个扩展来处理对话框中的各种 iFrame 问题...

http://plugins.jquery.com/project/jquery-framedialog

Another option if you're using jQueryUI's dialog, I wrote an extension a while ago that handles the various iFrame issues within a dialog...

http://plugins.jquery.com/project/jquery-framedialog

柳絮泡泡 2024-08-31 06:29:45

似乎适用于:


$("#pt_msgBox > p").html('<iframe style="width: 696px; height: 496px;"></iframe>');
$("#pt_msgBox").modal(pt_popup_options);
$('#pt_msgBox').find('iframe').attr('src', sURL);   

Seems to work with:


$("#pt_msgBox > p").html('<iframe style="width: 696px; height: 496px;"></iframe>');
$("#pt_msgBox").modal(pt_popup_options);
$('#pt_msgBox').find('iframe').attr('src', sURL);   
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文