complete-javascript-course
complete-javascript-course copied to clipboard
A question about the overlay of the Modal Window Project
" when we want to click the outside of a modal ,then the modal window closes . "I finished this by following teacher jonas .But i am confused about why we can do that ? the overlay is a empty div ,so why clicking the outside of a modal equals to clicking the empty div container.
I mean why i clicked the outside of a modal ,i clicked the overlay div . because the overlay div is empty ? what is the edge of this overlay div?
Overlay div has width and height 100% and class 'hidden' is removed from it too when modal is open. That's why wherever you click outside of the modal window you actually click on that overlay div. Click event on modal itself is not counted as click on overlay div because of the z-index property in css. Hope it helps.
Overlay div has width and height 100% and class 'hidden' is removed from it too when modal is open. That's why wherever you click outside of the modal window you actually click on that overlay div. Click event on modal itself is not counted as click on overlay div because of the z-index property in css. Hope it helps.
Get it ,Thank you for helping !!!!!