Created
October 12, 2017 13:13
-
-
Save Bewitchedyegor/a62eae2969821b3eba686b6d13512baf to your computer and use it in GitHub Desktop.
Closing any container when clicking outside of it
This file contains hidden or 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).mouseup(function(e) { | |
let container = $(".js-postOptionsMenu"); //insert container selector, multiple selectors for different containers will work fine | |
if (!container.is(e.target) && container.has(e.target).length === 0) { | |
container.fadeOut();//you can replace .fadeOut() with any other way to hide your container | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment