Created
January 8, 2019 16:13
-
-
Save melnikovslava2010/ccf6d0c329a2cbf9864a6ecd4fb8772d to your computer and use it in GitHub Desktop.
jq Повторный клик убирает элемент
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){ // событие клика по веб-документу | |
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