모달을 끌 때 닫기 버튼을 누를 수도 있지만 모달 밖의 화면을 누르면 꺼지도록 하는 방법
function closeModal() { modal.style.display = 'none'; } window.onclick = function(event) { if(event.target === modal) { closeModal(); } }