mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-12 16:07:59 +00:00
14 lines
334 B
JavaScript
14 lines
334 B
JavaScript
|
(function(jQuery) {
|
||
|
jQuery.fn.clickoutside = function(callback) {
|
||
|
var outside = 1, self = $(this);
|
||
|
self.cb = callback;
|
||
|
this.click(function() {
|
||
|
outside = 0;
|
||
|
});
|
||
|
$(document).click(function() {
|
||
|
outside && self.cb();
|
||
|
outside = 1;
|
||
|
});
|
||
|
return $(this);
|
||
|
}
|
||
|
})(jQuery);
|