Development/Javascript
[Javascript] 듀얼 모니터에서 팝업 중앙에 띄우기
레오나르도 다빈츠
2024. 1. 9. 08:47
handleOpenPopup() {
const width = 650
const height = 830
let left = Math.ceil((window.innerWidth - width) / 2) + window.screenLeft
let top = Math.ceil((window.innerHeight - height) / 2) + window.screenTop
window.open(
'url',
'팝업이름',
`width=${width}, height=${height}, left=${left}, top=${top}`,
)
},
개인적으로 공부한 내용을 정리하는 블로그로
잘못된 개념을 게시하지않도록 주의하고 있으나 오류가 있을 수 있습니다.