easyui window自动居中(修复了iframe弹窗被遮盖问题)

 1 $.extend($.fn.window.defaults, {
 2         onOpen:function(left, top){
 3             var iframeWidth = $(this).parent().parent().width();
 4             var iframeHeight = $(this).parent().parent().height();
 5             var windowWidth = $(this).parent().width();
 6             var windowHeight = $(this).parent().height();
 7             var setWidth = (iframeWidth - windowWidth) / 2;
 8             var setHeight = (iframeHeight - windowHeight) / 2;
 9             $(this).parent().css({
10                 left: setWidth,
11                 top: setHeight
12             });
13             if (iframeHeight < windowHeight)
14             {
15                 $(this).parent().css({
16                     left: setWidth,
17                     top: 0
18                 });
19             }
20             $(".window-shadow").hide();
21         }
22 });

 

posted @ 2016-12-12 10:39  这个冬天有点冷  阅读(1387)  评论(0编辑  收藏  举报