在jquery.simplemodal中使用iframe,当弹出窗口关闭时iframe重新加载 [英] Using an iframe in jquery.simplemodal, the iframe reload when the popup is closed

查看:179
本文介绍了在jquery.simplemodal中使用iframe,当弹出窗口关闭时iframe重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

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.

谢谢!

推荐答案

我遇到了同样的问题.

I had the same problem.

最简单的解决方法是设置persist选项.

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

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

自simplemodal-1.3.5起

As of simplemodal-1.3.5

persist :(布尔值:false)跨模式调用持久化数据吗?仅有的 用于现有的DOM元素.如果为true,则将保留数据 跨模式调用,如果为false,则数据将还原为 原始状态.

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.

这篇关于在jquery.simplemodal中使用iframe,当弹出窗口关闭时iframe重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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