Created
June 14, 2019 23:02
-
-
Save andrii-kvlnko/89893019daddd976581540585a7fa259 to your computer and use it in GitHub Desktop.
Process clicking | touching outside . Jquery
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).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