twister-html/js/jQueryPlugins.js
2014-03-16 22:19:37 -03: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);