Last active
December 18, 2018 18:10
-
-
Save RuslanAsadov/d099081299cd4b14d8f8407491e17d60 to your computer and use it in GitHub Desktop.
click-close-block.js
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
$('.wrap__button').click(function() { | |
$('.wrap__selector').stop().slideToggle(); //Появление и исчезание блока | |
$('.wrap__field').focus(); //Устанока поля в фокус | |
}); | |
$(document).keyup(function(e) { //Отслеживание ESC | |
if(e.keyCode == 27) { | |
$('.wrap__selector').slideUp(); | |
} | |
}).click(function() { //клик на document, закрытие | |
$('.wrap__selector').slideUp(); | |
}); | |
$('.wrap').click(function(e) { //остановка, если клик на wrapper | |
e.stopPropagation(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment