IT/jquery_javascript
레이어 팝업 가운데 정렬
당양부부34
2015. 9. 15. 14:58
$(document).ready(function() {
$.fn.center = function () {
this.css("position","absolute");
this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + $(window).scrollTop()) + "px");
this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + $(window).scrollLeft()) + "px");
return this;
}
$("body").append("<div id='payIngPopup'></div>");
$("#popLayer").show();
$("#popLayer").center();
});
<div id="popLayer" style="display:none;z-index: 9999;">