通过自建iframe遮罩层解决flash位于window窗口之上的问题
2011-01-12 10:19
876 查看
效果对于固定不动窗口或菜单则更有效,并不太适用于可移动的窗口,遮罩层与窗口位置很难一致。若是可移动的窗口建议用前面一篇文章所介绍的shim属性Ext自身提供的方法。
同样下面的方法只对IE有效,firefox下依然无效。
Ext.onReady(function() {
......
//创建垫片效果iframe遮罩层
function createShim(coordinate) {
closeShim();
var shimmer = document.createElement('iframe');
shimmer.id='shimmer';
shimmer.style.position='absolute';
shimmer.style.top=coordinate.top;
shimmer.style.left=coordinate.left;
shimmer.style.width=coordinate.width;
shimmer.style.height=coordinate.height;
shimmer.style.zIndex='999';
shimmer.setAttribute('frameborder','0');
// shimmer.setAttribute('src','javascript:false;');
document.body.appendChild(shimmer);
}
//移除iframe遮罩层
function closeShim(){
var shimmer = document.getElementById('shimmer')
if(shimmer){
document.body.removeChild(shimmer);
}
}
// 查询窗口对象变量
var searchWin;
// 查询按钮
function doSearch_pic_panel() {
searchWin = Ext.getCmp('search-window'); //避免出现显示两个窗口的问题
if (!searchWin) {
searchWin = new Ext.Window({
contentEL:'search-window',
title : '请输入查询条件',
layout : 'fit',
width : 400,
height : 300,
closeAction : 'hide',
plain : true,
floating:true,
shim:true,
items : searchFormPanel_pic_panel,
buttons : [{
text : '查询',
handler : function() {
searchWin.hide();
}
}, {
text : '关闭',
handler : function() {
searchWin.hide();
}
}]
});
searchWin.on("show",function(window){
var winEl = window;
var position =new Array();
position = winEl.getPosition(true);
createShim({
top:position[1],
left:position[0],
width:winEl.getFrameWidth()+winEl.getInnerWidth(),
height:winEl.getFrameHeight()+winEl.getInnerHeight()
});
});
searchWin.on("hide",function(window){
closeShim();
});
searchWin.on("beforemove",function(component,x,y){
closeShim();
});
searchWin.on("move",function(component,x,y){
closeShim();
var winEl = Ext.getCmp('search-window');
var position =new Array();
position = winEl.getPosition(true);
createShim({
top:y,
left:x,
width:winEl.getFrameWidth()+winEl.getInnerWidth(),
height:winEl.getFrameHeight()+winEl.getInnerHeight()
});
});
}
searchWin.show();
}
......
}
其实贴出来主要是学习这一种思想。网上也有关于该问题的讨论:
Why does moving the IFRAME shim slow things down?
链接地址:https://www.extjs.com/forum/showthread.php?1384-Why-does-moving-the-IFRAME-shim-slow-things-down
Iframe Shim解决applet挡住ExtJS工具栏菜单问题
链接地址:http://agile-boy.javaeye.com/blog/140935
[OPEN-884] Shim size problem on Ext.Window with shadow
链接地址:http://www.extjs.com/forum/showthread.php?97413-OPEN-884-Shim-size-problem-on-Ext.Window-with-shadow&p=459829#post459829
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/foamflower/archive/2010/04/21/5512865.aspx
同样下面的方法只对IE有效,firefox下依然无效。
Ext.onReady(function() {
......
//创建垫片效果iframe遮罩层
function createShim(coordinate) {
closeShim();
var shimmer = document.createElement('iframe');
shimmer.id='shimmer';
shimmer.style.position='absolute';
shimmer.style.top=coordinate.top;
shimmer.style.left=coordinate.left;
shimmer.style.width=coordinate.width;
shimmer.style.height=coordinate.height;
shimmer.style.zIndex='999';
shimmer.setAttribute('frameborder','0');
// shimmer.setAttribute('src','javascript:false;');
document.body.appendChild(shimmer);
}
//移除iframe遮罩层
function closeShim(){
var shimmer = document.getElementById('shimmer')
if(shimmer){
document.body.removeChild(shimmer);
}
}
// 查询窗口对象变量
var searchWin;
// 查询按钮
function doSearch_pic_panel() {
searchWin = Ext.getCmp('search-window'); //避免出现显示两个窗口的问题
if (!searchWin) {
searchWin = new Ext.Window({
contentEL:'search-window',
title : '请输入查询条件',
layout : 'fit',
width : 400,
height : 300,
closeAction : 'hide',
plain : true,
floating:true,
shim:true,
items : searchFormPanel_pic_panel,
buttons : [{
text : '查询',
handler : function() {
searchWin.hide();
}
}, {
text : '关闭',
handler : function() {
searchWin.hide();
}
}]
});
searchWin.on("show",function(window){
var winEl = window;
var position =new Array();
position = winEl.getPosition(true);
createShim({
top:position[1],
left:position[0],
width:winEl.getFrameWidth()+winEl.getInnerWidth(),
height:winEl.getFrameHeight()+winEl.getInnerHeight()
});
});
searchWin.on("hide",function(window){
closeShim();
});
searchWin.on("beforemove",function(component,x,y){
closeShim();
});
searchWin.on("move",function(component,x,y){
closeShim();
var winEl = Ext.getCmp('search-window');
var position =new Array();
position = winEl.getPosition(true);
createShim({
top:y,
left:x,
width:winEl.getFrameWidth()+winEl.getInnerWidth(),
height:winEl.getFrameHeight()+winEl.getInnerHeight()
});
});
}
searchWin.show();
}
......
}
其实贴出来主要是学习这一种思想。网上也有关于该问题的讨论:
Why does moving the IFRAME shim slow things down?
链接地址:https://www.extjs.com/forum/showthread.php?1384-Why-does-moving-the-IFRAME-shim-slow-things-down
Iframe Shim解决applet挡住ExtJS工具栏菜单问题
链接地址:http://agile-boy.javaeye.com/blog/140935
[OPEN-884] Shim size problem on Ext.Window with shadow
链接地址:http://www.extjs.com/forum/showthread.php?97413-OPEN-884-Shim-size-problem-on-Ext.Window-with-shadow&p=459829#post459829
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/foamflower/archive/2010/04/21/5512865.aspx
相关文章推荐
- 通过自建iframe遮罩层解决flash位于window窗口之上的问题
- 采用Window对象shim属性解决IE下flash位于弹出窗口之上遮住窗口问题——此方法对firefox暂未解决
- 采用Window对象shim属性解决IE下flash位于弹出窗口之上遮住窗口问题——此方法对firefox暂未解决
- 通过一个小技巧可以让flash和iframe的在ie下遮挡问题解决
- 通过P3P协议,实现跨域set cookie,解决同域IFRAME中SESSION传递失效问题
- 解决Chrome窗口总保持在最前面的问题 get rid of Chrome window always-on-top behavior
- 解决弹出的窗口window.open会被浏览器阻止的问题
- window.showdialog完全手册,解决模态窗口,传值和返回值问题
- iframe中session超时,跳转打开窗口还是嵌入在iframe中问题解决
- 解决通过startup.bat脚本启动tomcat时,cmd命令窗口闪现问题!
- ie屏蔽flash弹出窗口问题的解决办法
- 使用Layer弹出iframe表单窗口,有几率无法成功提交表单问题解决
- 解决弹出的窗口window.open会被chrome浏览器阻止的问题
- 终于解决了一个困扰我许久的问题:通过window.showModalDialog打开的页面,Form提交,标题丢失
- 通过伪协议解决父页面与iframe页面通信的问题
- 打开新窗口的window.open使用方法以及最大化等问题解决方法汇总
- 关于mac下beginSheet:modalForWindow:modalDelegate:卷帘窗口挂载不上的问题及解决方法
- 解决弹出的窗口window.open会被浏览器阻止的问题(自定义open方法)
- javascript window.open打开新窗口后无法再次打开该窗口问题的解决方法
- 钩子中向窗口发送消息、操作窗口无反应的问题解决方法(Hook dll ShowWindow HWND)