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 });