Skip to content

Instantly share code, notes, and snippets.

@andrii-kvlnko
Created June 14, 2019 23:02
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 andrii-kvlnko/89893019daddd976581540585a7fa259 to your computer and use it in GitHub Desktop.
Save andrii-kvlnko/89893019daddd976581540585a7fa259 to your computer and use it in GitHub Desktop.
Process clicking | touching outside . Jquery
$(document).bind(
'touchend.namespace',
hideByClickingOutsideListener.bind(this, container)
);
function hideByClickingOutsideListener(containerElement, event) {
const container = $(containerElement);
if (!container.is(event.target) && container.has(event.target).length === 0) {
$(document).unbind('touchend.namespace');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment