设置DIV在屏幕中央

// 弹出窗口 在屏幕中央
jQuery.fn.center=function(){
this.css("position","absolute");
this.css("top",($(window).height()-this.height())/2+$(window).scrollTop()+"px");
this.css("left",($(window).width()-this.width())/2+$(window).scrollLeft()+"px");
return this;
}
$(".popup_content").center();

posted @ 2016-05-06 15:38  Kelly.Shi  阅读(249)  评论(0)    收藏  举报