모달 할 수있는 고전적인 방법은 콘텐츠 (대화 상자)와 Z- 색인 낮은 (오버레이) div 가진 div입니다 그런 다음 오버레이 클릭 이벤트를 바인딩 할 수 및 de 콘텐츠 대화 상자.외부를 클릭하여 div (모달)를 닫는 방법. Pinterest 및 페이 스북 방법
<div class="dialog">...</div>
<div class="overlay" style="background-color:rgba(255, 255, 255, 0.9)">
그러나 나는 Pinterest와 Facebook이 그것을 하나의 div에 결합시킨 것을 알아 챘다.
<div class="overlay" style="background-color:rgba(255, 255, 255, 0.9);position: fixed; z-index: 9999;top: 0;right: 0;bottom: 0;left: 0;">
<div class="dialog" style="position: static;"></div>
</div>
그러나이 방법에서는 대화 상자가없는 오버레이에서만 대화 상자를 닫으려면 클릭 이벤트를 어떻게 바인딩 할 수 있습니까? 이 같은 일을함으로써
덕분에 완전히 – Luccas
'인 stopPropagation()가'절대 권장하는 인 stopPropagation() (= 필수 항목 https://css-tricks.com/dangers-stopping-event-propagation/ – user664833