Skip to content

Instantly share code, notes, and snippets.

@bbongagus
Created November 28, 2016 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbongagus/abe91b5a08cbb124671cc67f1050d87b to your computer and use it in GitHub Desktop.
Save bbongagus/abe91b5a08cbb124671cc67f1050d87b to your computer and use it in GitHub Desktop.
hide element, when click out of range
function closeOnClickOver(modalid, parentid){
$(parentid).on('click', function(e){
if (e.target == $(modalid).prop("parentNode")){
$(parentid).addClass("g-visuallyhidden");
setTimeout(function(){
$(parentid).addClass("g-hidden");
}, 200);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment