<script>
$(function() {
$("a.open-window").on("click", function(e) {
e.preventDefault();
const link = $(this).attr("href");
const popupWidth = 500;
const popupHeight = 500;
const screenLeft = window.screenLeft ?? window.screenX;
const screenTop = window.screenTop ?? window.screenY;
const screenWidth = window.innerWidth;
const screenHeight = window.innerHeight;
const left = screenLeft + (screenWidth - popupWidth) / 2;
const top = screenTop + (screenHeight - popupHeight) / 2;
window.open(link, "register", `width=${ popupWidth }, height=${ popupHeight }, top=${ top }, left=${ left }, scrollbars=no`);
});
});
</script>
<a href="https://naver.com" class="open-window">naver</a>
'Programming > Javascript' 카테고리의 다른 글
[chart.js]width, height 지정하기 (2) | 2021.01.12 |
---|---|
유튜브 아이디 갖고 오기 (0) | 2020.12.08 |
div 랜덤으로... (0) | 2020.11.16 |
Datepicker 특정 날짜 클릭 안 되게... (0) | 2020.11.11 |
[jQuery]name이 배열일 경우 (0) | 2020.11.11 |