mwheelintent-rails 1.2.1 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +1 -1
- data/lib/mwheelintent-rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.mwheelintent.js +14 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDVhMTM2MmQ3ZGFiNzNmYjRmMmY1NzVhNjNhYjdjODM4NThjZmJiMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjE0NThlYjg2NzJmYjk5MTk2ZWU1YTZlNzE1ZDBlZDgyNjI0NTI4ZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDYzMGViNDVhMmE0MDY3MmJhNWM2NGY5NjM0YWUwZWU3MjhhNzhmODhhNWEy
|
10
|
+
ZGVjYzhjYmNlMTNlYTZjYmVkOGM3MDUxYjQxMTliMGI3OGMwZjhmYjFiOWQ1
|
11
|
+
ZGI4ZGQyNjExODc2NTBmZDUwZGNkZDcxZWZmN2Q3ODQ3ZmEyYWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjY5MThiNjgxZTQ5ODMwM2EwMjU4NGRkNjRkZGQ1NjcyNDU0ODgzZjk3NDYz
|
14
|
+
YWI1MmI0ODFiN2NkZWFkOGNjMWFjODAzNDhlMjgyYzk4OTQyODA1ZjQ2ZTY2
|
15
|
+
YjdlOTBiODQxZjNkNjFjMGNjZWY2ZjIwZjVlZTFhYWQ0OWQwMTc=
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# jQuery MouseWheel Intent plugin for Rails
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/mwheelintent-rails.png)](http://badge.fury.io/rb/mwheelintent-rails)
|
3
3
|
|
4
|
-
A ruby gem that uses the Rails asset pipeline to include the jQuery MouseWheel Intent plugin by trixta.
|
4
|
+
A ruby gem that uses the Rails asset pipeline to include the jQuery MouseWheel Intent plugin by trixta and bodrovis.
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
@@ -1,9 +1,8 @@
|
|
1
1
|
/**
|
2
|
-
* @author trixta
|
3
|
-
* @version 1.
|
2
|
+
* @author trixta and bodrovis
|
3
|
+
* @version 1.3
|
4
4
|
*/
|
5
5
|
(function($){
|
6
|
-
|
7
6
|
var mwheelI = {
|
8
7
|
pos: [-260, -260]
|
9
8
|
},
|
@@ -23,24 +22,25 @@
|
|
23
22
|
}
|
24
23
|
|
25
24
|
$.event.special.mwheelIntent = {
|
26
|
-
setup: function(){
|
27
|
-
var jElm = $(this).
|
25
|
+
setup: function() {
|
26
|
+
var jElm = $(this).on('mousewheel', $.event.special.mwheelIntent.handler);
|
28
27
|
if( this !== doc && this !== root && this !== body ){
|
29
|
-
jElm.
|
28
|
+
jElm.on('mouseleave', unsetPos);
|
30
29
|
}
|
31
30
|
jElm = null;
|
32
31
|
return true;
|
33
32
|
},
|
34
33
|
teardown: function(){
|
35
34
|
$(this)
|
36
|
-
.
|
37
|
-
.
|
35
|
+
.off('mousewheel', $.event.special.mwheelIntent.handler)
|
36
|
+
.off('mouseleave', unsetPos)
|
38
37
|
;
|
39
38
|
return true;
|
40
39
|
},
|
41
|
-
handler: function(e, d){
|
40
|
+
handler: function(e, d) {
|
42
41
|
var pos = [e.clientX, e.clientY];
|
43
|
-
if( this === mwheelI.elem || Math.abs(mwheelI.pos[0] - pos[0]) > minDif ||
|
42
|
+
if( this === mwheelI.elem || Math.abs(mwheelI.pos[0] - pos[0]) > minDif ||
|
43
|
+
Math.abs(mwheelI.pos[1] - pos[1]) > minDif ) {
|
44
44
|
mwheelI.elem = this;
|
45
45
|
mwheelI.pos = pos;
|
46
46
|
minDif = 250;
|
@@ -58,19 +58,20 @@
|
|
58
58
|
}
|
59
59
|
}
|
60
60
|
};
|
61
|
+
|
61
62
|
$.fn.extend({
|
62
63
|
mwheelIntent: function(fn) {
|
63
|
-
return fn ? this.
|
64
|
+
return fn ? this.on("mwheelIntent", fn) : this.trigger("mwheelIntent");
|
64
65
|
},
|
65
66
|
|
66
67
|
unmwheelIntent: function(fn) {
|
67
|
-
return this.
|
68
|
+
return this.off("mwheelIntent", fn);
|
68
69
|
}
|
69
70
|
});
|
70
71
|
|
71
72
|
$(function(){
|
72
73
|
body = doc.body;
|
73
74
|
//assume that document is always scrollable, doesn't hurt if not
|
74
|
-
$(doc).
|
75
|
+
$(doc).on('mwheelIntent.mwheelIntentDefault', $.noop);
|
75
76
|
});
|
76
77
|
})(jQuery);
|