twister-html/jQueryPlugins.js
2013-12-30 12:42:36 -02:00

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);