Easyui 让Window弹出居中与最大化后居中
2013-11-23 18:53
399 查看
easyui1.3.2版本,window的弹出不会居中了。而dialog是会居中的,我们必须为为window的open事件做扩展
代码如下:只要加入以下代码即可.如果你是看了MVC项目系列的,把他放到jquery.easyui.plus.js里面就可以了
完美居中。
点击最大化后,再次最小化时也会出现不居中现象,我们必须,扩展resize事件。
window组件可以兼容了
代码如下:只要加入以下代码即可.如果你是看了MVC项目系列的,把他放到jquery.easyui.plus.js里面就可以了
//让window居中 var easyuiPanelOnOpen = function (left, top) { var iframeWidth = $(this).parent().parent().width(); var iframeHeight = $(this).parent().parent().height(); var windowWidth = $(this).parent().width(); var windowHeight = $(this).parent().height(); var setWidth = (iframeWidth - windowWidth) / 2; var setHeight = (iframeHeight - windowHeight) / 2; $(this).parent().css({/* 修正面板位置 */ left: setWidth, top: setHeight }); if (iframeHeight < windowHeight) { $(this).parent().css({/* 修正面板位置 */ left: setWidth, top: 0 }); } $(".window-shadow").hide(); }; $.fn.window.defaults.onOpen = easyuiPanelOnOpen;
完美居中。
点击最大化后,再次最小化时也会出现不居中现象,我们必须,扩展resize事件。
var easyuiPanelOnResize = function (left, top) { var iframeWidth = $(this).parent().parent().width(); var iframeHeight = $(this).parent().parent().height(); var windowWidth = $(this).parent().width(); var windowHeight = $(this).parent().height(); var setWidth = (iframeWidth - windowWidth) / 2; var setHeight = (iframeHeight - windowHeight) / 2; $(this).parent().css({/* 修正面板位置 */ left: setWidth-6, top: setHeight-6 }); if (iframeHeight < windowHeight) { $(this).parent().css({/* 修正面板位置 */ left: setWidth, top: 0 }); } $(".window-shadow").hide(); //$(".window-mask").hide().width(1).height(3000).show(); }; $.fn.window.defaults.onResize = easyuiPanelOnResize;
window组件可以兼容了
相关文章推荐
- Easyui 让Window弹出居中与最大化后居中
- Easyui 让Window弹出居中
- Easyui 让Window弹出居中
- JS中window.open弹出窗口居中
- open.window弹出窗口实现居中
- 点击链接,弹出最大化窗口可能水平和垂直方向都居中的小窗口
- 点击链接,弹出最大化窗口或者水平和垂直方向都居中的小窗口
- 弹出窗口居中(window.open)
- JS中window.open弹出窗口居中
- easyUi弹出window窗口传值与调用父页面的方法,子页面给父页面赋值
- window.open()弹出居中的窗口
- 怎么弹出一个既不会被拦截,又是window.open方式实现的最大化弹出窗口?
- 火狐下easyui1.3.1弹出window框定…
- EasyUI刚加载时候Window窗体自动弹出的解决办法
- 用window.open打开的新窗口如何居中弹出
- window.open弹出窗口居中
- jquery easyui window 不居中有关问题解决方案 (注意红色字体部分)
- window.open窗口居中和窗口最大化
- Easyui 之window 弹出框
- 【库房】easyui的messager.show弹出框页面居中显示