asp.net – 移动ModalPopup在IFrame之外 可能?
|
我的主页里面有一个iframe iframe页面中有一个模式。所以当显示modalpopup时,modalpopup的父项是iframe主体和主页父体。因此,覆盖只覆盖了iframe而不是整个页面。 我尝试使用jQuery将modalpopup从iframe移动到父窗体body元素(或父体内的任何其他元素)。我得到一个无效的参数错误。 如何从iframe中的页面显示一个模式,并且它应该覆盖整个文档,父文档? 更新: 因为很少有用户对实现相同的行为感兴趣。这里是解决方法 我建议的最好的解决方法是在主页面中添加模态文件,然后从iframe中调用它。说这样的东西.. /* function in the main(parent) page */
var _onMyModalPopupHide = null;
function pageLoad(){
// would be called by ScriptManager when page loads
// add the callback that will be called when the modalpopup is closed
$find('MyModalPopupBehaviorID').add_hidden(onMyModalPopupHide);
}
// will be invoked from the iframe to show the popup
function ShowMyModalPopup(callback) {
_onMyModalPopupHide = callback;
$find('MyModalPopupBehaviorID').show();
}
/* this function would be called when the modal popup is closed */
function onMyModalPopupHide(){
if (typeof(_onMyModalPopupHide) === "function") {
// fire the callback function
_onMyModalPopupHide.call(this);
}
}
/* functions in the page loaded in the iframe */
function ShowPopup(){
if(typeof(window.parent.ShowMyModalPopup) === "function") {
window.parent.ShowMyModalPopup.apply(this,[OnPopupClosed]);
}
}
// will be invoked from the parent page .. after the popup is closed
function OnPopupClosed(){
// do something after the modal popup is closed
}
希望它有帮助 解决方法如果您只是使用iframe进行可滚动的内容,那么您可能会认为具有溢出的风格的div:auto或scroll。这样的设置使得更容易修改整个页面的外观,因为您不使用每个本质上在页面内部具有自己的窗口空间的多个文档。您可以绕过一些跨框架通信,如果需要这样做,可能会更容易保持信息同步。 这可能不适用于所有情况,可能需要ajax(或使用javascript修改dom)来更改div内容,而不是仅在iframe中加载其他文档。此外,一些较旧的移动浏览器,如Android Froyo构建,不能很好地处理可滚动的div。 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- ASP.NET – DataSourceID和DataSource有什么区别?
- datetime – 如何指定模型绑定的日期格式?
- asp.net – 使用Entity Framework的仓库模式(mvc storefron
- asp.net-mvc – 具有区域的Url.Action()返回空字符串
- asp.net-mvc – ASP.NET MVC中的CSS/JS文件的自动版本?
- ASP.NET入口点?
- asp.net-mvc – 为什么这个路由参数被添加到查询字符串中?
- asp.net-mvc – MVC:覆盖默认的ValidationMessage
- .net – 扩展自定义成员资格提供程序
- asp.net-mvc – ASP.NET MVC 4中的Windows身份验证和表单身
- asp.net – 如何在web.config中定义using语句?
- asp.net核心 – Microsoft Asp.Net 5 RC1
- asp.net中使用repeater和PageDataSource搭配实现
- asp.net-mvc – 如何使用Ninject将服务注入授权过
- asp.net – Linq更新查询生成哪里0 = 1?
- asp.net中XML如何做增删改查操作
- asp.net-mvc – 使用jQuery ASP.NET MVC自动保存
- asp.net – HTTP错误403.14 – 访问网站时出现禁
- asp.net-mvc – ASP.NET MVC路由 – “空白”路由
- asp.net mvc c#获取页面的url来自
