元素定位自动居中 .html
<div class="dialoge-set">
</div>
元素定位自动居中 .js
//元素定位自动居中
jQuery.fn.center = function() {
this.css("position", "absolute");
this.css("top","50%");
this.css('left',"50%");
this.css("margin-top", -(this.innerHeight()) / 2 + "px");
this.css("margin-left", -(this.innerWidth()) / 2 + "px");
return this;
}
//弹窗其他设置
$('.dialoge-set').center();