Last active
May 23, 2021 06:26
-
-
Save karamanskiy/0b610cda6b9d4ed00a87d9da7bd56ee1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($){ | |
$(document).mouseup(function (e){ // событие клика по веб-документу (or .on(touchstart click)) | |
var div = $("#popup"); // тут указываем ID элемента | |
if (!div.is(e.target) // если клик был не по нашему блоку | |
&& div.has(e.target).length === 0) { // и не по его дочерним элементам | |
div.hide(); // скрываем его | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment