Created
September 7, 2017 13:35
-
-
Save ihorduchenko/90d7c9c3fac3eec792e31faa7344da0a to your computer and use it in GitHub Desktop.
Hide dropdown block when click elsewhere
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
$(document).click(function (e) { | |
e.stopPropagation(); | |
var container = $(".menu-item-has-children>a"); //Parent of dropdown block | |
//check if the clicked area is dropDown or not | |
if (container.has(e.target).length === 0) { | |
$('.menu-item-has-children .dropdown-menu').removeClass('d-block'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment