forked from alexblack/google-fastbutton
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery.google.fastbutton.js
More file actions
44 lines (41 loc) · 1.09 KB
/
jquery.google.fastbutton.js
File metadata and controls
44 lines (41 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(function (factory) {
if (typeof exports === 'object') {
// CommonJS
module.exports = factory(require('jquery'));
} else if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else {
factory(jQuery);
}
}(function($) {
'use strict';
$.event.special.fastClick = {
setup: function () {
$(this).data(
'fastClick',
new window.FastButton(this, $.event.special.fastClick.handler)
);
},
teardown: function () {
$(this).data('fastClick').destroy();
$(this).removeData('fastClick');
},
handler: function (e) {
// convert native event to jquery event
e = $.event.fix(e);
e.type = 'fastClick';
/*
event.handle is deprecated and removed as of version 1.9
use event.dispatch instead,
$.event.handle.apply(this, arguments);
*/
$.event.dispatch.apply(this, arguments);
}
};
$.fn.fastClick = function(fn) {
return $(this).each(function() {
return fn ? $(this).bind('fastClick', fn) : $(this).trigger('fastClick');
});
};
}));