JQuery Easyui Window弹出框居中
最近在学习JQueryEasyUI,发现Window在弹出的时候并不会每次都居中,而是会显示在上次关闭时的位置。我想让其每次都居中显示,尝试多次无果后在网上找到了以下代码,只要再页面中引入即可。
参考链接:http://www.java123.net/570754.html
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;
相关推荐
zrtlin 2020-11-09
xuebingnan 2020-11-05
wikiwater 2020-10-27
heheeheh 2020-10-19
Crazyshark 2020-09-15
softwear 2020-08-21
ZGCdemo 2020-08-16
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19
Skyline 2020-07-04
xiaofanguan 2020-06-25
Aveiox 2020-06-23
dragonzht 2020-06-17