Close modal by clicking on the background but not on the content

I have a modal that fadesIn and displays a video.

I would like to click the modal background color (which fills the screen 100% x100%) to close the modal. The problem is how I encoded it at the moment, if I press the video player control button, it also closes the modal one.

Spell here:

http://jsfiddle.net/PWGHH/

Thanks.

+6
source share
2 answers

Try the following:

$('#commercial1').click(function(event) { event.stopPropagation(); }); 
+9
source

My solution for you is to separate the 100% div from the video object, but also make a fae effect on both of them and make the click event on the v100% div.

0
source

Source: https://habr.com/ru/post/894133/


All Articles