bem
Version:
40 lines (27 loc) • 696 B
JavaScript
/**
* leftClick event plugin
*
* Copyright (c) 2010 Filatov Dmitry (alpha@zforms.ru)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* @version 1.0.0
*/
(function($) {
var leftClick = $.event.special.leftclick = {
setup : function() {
$(this).bind('click', leftClick.handler);
},
teardown : function() {
$(this).unbind('click', leftClick.handler);
},
handler : function(e) {
if(!e.button) {
e.type = 'leftclick';
$.event.handle.apply(this, arguments);
e.type = 'click';
}
}
};
})(jQuery);