Created
December 30, 2016 03:45
-
-
Save think2011/8e1877641fe705943e8259c3c2edaedf to your computer and use it in GitHub Desktop.
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
function outerClick(selector, fn) { | |
$(document).on("click", function (event) { | |
var isHit = $(event.target).closest(selector).length | |
if (!isHit) fn.call(fn, event) | |
}) | |
return function () { | |
$(document).off('click', fn) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment