<script type="text/javascript">
...
jQuery.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;
}
...
showPopup = function() {
$("#popLayer").show();
$("#popLayer").center();
}
</script>
<body>
...
<a href="javascript:;" onclick="javascript:showPopup()">팝업띄우기</a>
...
</body>
<div id="popLayer" style="display:none;">
<div>팝업 레이어입니다.</div>
<div>
코드 출처 : http://stackoverflow.com/questions/210717/using-jquery-to-center-a-div-on-the-screen
출처 : http://ooz.co.kr/78