Version Description
- Tested on WP 4.4
- Use different jQuery library
- Repair scripts enqueue dependencies
- Ctrl + scroll is now zooming - default browser behaviour
Download this release
Release Info
Developer | kubiq |
Plugin | MouseWheel Smooth Scroll |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 1.2
- js/jQuery.scrollSpeed.js +100 -0
- js/jquery.easing.1.3.js +0 -133
- js/jquery.easing.min.js +14 -0
- js/jquery.mousewheel.min.js +0 -1
- js/jquery.simplr.smoothscroll.js +0 -64
- js/wpmss.php +2 -8
- mousewheel-smooth-scroll.php +4 -5
- readme.txt +9 -3
js/jQuery.scrollSpeed.js
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Custom scrolling speed with jQuery
|
2 |
+
// Source: github.com/ByNathan/jQuery.scrollSpeed
|
3 |
+
// Version: 1.0.2
|
4 |
+
|
5 |
+
(function($) {
|
6 |
+
|
7 |
+
jQuery.scrollSpeed = function(step, speed, easing) {
|
8 |
+
|
9 |
+
var $document = $(document),
|
10 |
+
$window = $(window),
|
11 |
+
$body = $('html, body'),
|
12 |
+
option = easing || 'default',
|
13 |
+
root = 0,
|
14 |
+
scroll = false,
|
15 |
+
scrollY,
|
16 |
+
scrollX,
|
17 |
+
view;
|
18 |
+
|
19 |
+
if (window.navigator.msPointerEnabled)
|
20 |
+
|
21 |
+
return false;
|
22 |
+
|
23 |
+
$window.on('mousewheel DOMMouseScroll', function(e) {
|
24 |
+
|
25 |
+
if( ! e.ctrlKey ){
|
26 |
+
var deltaY = e.originalEvent.wheelDeltaY,
|
27 |
+
detail = e.originalEvent.detail;
|
28 |
+
scrollY = $document.height() > $window.height();
|
29 |
+
scrollX = $document.width() > $window.width();
|
30 |
+
scroll = true;
|
31 |
+
|
32 |
+
if (scrollY) {
|
33 |
+
|
34 |
+
view = $window.height();
|
35 |
+
|
36 |
+
if (deltaY < 0 || detail > 0)
|
37 |
+
|
38 |
+
root = (root + view) >= $document.height() ? root : root += step;
|
39 |
+
|
40 |
+
if (deltaY > 0 || detail < 0)
|
41 |
+
|
42 |
+
root = root <= 0 ? 0 : root -= step;
|
43 |
+
|
44 |
+
$body.stop().animate({
|
45 |
+
|
46 |
+
scrollTop: root
|
47 |
+
|
48 |
+
}, speed, option, function() {
|
49 |
+
|
50 |
+
scroll = false;
|
51 |
+
|
52 |
+
});
|
53 |
+
}
|
54 |
+
|
55 |
+
if (scrollX) {
|
56 |
+
|
57 |
+
view = $window.width();
|
58 |
+
|
59 |
+
if (deltaY < 0 || detail > 0)
|
60 |
+
|
61 |
+
root = (root + view) >= $document.width() ? root : root += step;
|
62 |
+
|
63 |
+
if (deltaY > 0 || detail < 0)
|
64 |
+
|
65 |
+
root = root <= 0 ? 0 : root -= step;
|
66 |
+
|
67 |
+
$body.stop().animate({
|
68 |
+
|
69 |
+
scrollLeft: root
|
70 |
+
|
71 |
+
}, speed, option, function() {
|
72 |
+
|
73 |
+
scroll = false;
|
74 |
+
|
75 |
+
});
|
76 |
+
}
|
77 |
+
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
}).on('scroll', function() {
|
83 |
+
|
84 |
+
if (scrollY && !scroll) root = $window.scrollTop();
|
85 |
+
if (scrollX && !scroll) root = $window.scrollLeft();
|
86 |
+
|
87 |
+
}).on('resize', function() {
|
88 |
+
|
89 |
+
if (scrollY && !scroll) view = $window.height();
|
90 |
+
if (scrollX && !scroll) view = $window.width();
|
91 |
+
|
92 |
+
});
|
93 |
+
};
|
94 |
+
|
95 |
+
jQuery.easing.default = function (x,t,b,c,d) {
|
96 |
+
|
97 |
+
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
98 |
+
};
|
99 |
+
|
100 |
+
})(jQuery);
|
js/jquery.easing.1.3.js
DELETED
@@ -1,133 +0,0 @@
|
|
1 |
-
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
2 |
-
|
3 |
-
jQuery.extend( jQuery.easing,
|
4 |
-
{
|
5 |
-
def: 'easeOutQuad',
|
6 |
-
swing: function (x, t, b, c, d) {
|
7 |
-
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
8 |
-
},
|
9 |
-
easeInQuad: function (x, t, b, c, d) {
|
10 |
-
return c*(t/=d)*t + b;
|
11 |
-
},
|
12 |
-
easeOutQuad: function (x, t, b, c, d) {
|
13 |
-
return -c *(t/=d)*(t-2) + b;
|
14 |
-
},
|
15 |
-
easeInOutQuad: function (x, t, b, c, d) {
|
16 |
-
if ((t/=d/2) < 1) return c/2*t*t + b;
|
17 |
-
return -c/2 * ((--t)*(t-2) - 1) + b;
|
18 |
-
},
|
19 |
-
easeInCubic: function (x, t, b, c, d) {
|
20 |
-
return c*(t/=d)*t*t + b;
|
21 |
-
},
|
22 |
-
easeOutCubic: function (x, t, b, c, d) {
|
23 |
-
return c*((t=t/d-1)*t*t + 1) + b;
|
24 |
-
},
|
25 |
-
easeInOutCubic: function (x, t, b, c, d) {
|
26 |
-
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
27 |
-
return c/2*((t-=2)*t*t + 2) + b;
|
28 |
-
},
|
29 |
-
easeInQuart: function (x, t, b, c, d) {
|
30 |
-
return c*(t/=d)*t*t*t + b;
|
31 |
-
},
|
32 |
-
easeOutQuart: function (x, t, b, c, d) {
|
33 |
-
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
34 |
-
},
|
35 |
-
easeInOutQuart: function (x, t, b, c, d) {
|
36 |
-
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
37 |
-
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
38 |
-
},
|
39 |
-
easeInQuint: function (x, t, b, c, d) {
|
40 |
-
return c*(t/=d)*t*t*t*t + b;
|
41 |
-
},
|
42 |
-
easeOutQuint: function (x, t, b, c, d) {
|
43 |
-
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
44 |
-
},
|
45 |
-
easeInOutQuint: function (x, t, b, c, d) {
|
46 |
-
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
47 |
-
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
48 |
-
},
|
49 |
-
easeInSine: function (x, t, b, c, d) {
|
50 |
-
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
51 |
-
},
|
52 |
-
easeOutSine: function (x, t, b, c, d) {
|
53 |
-
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
54 |
-
},
|
55 |
-
easeInOutSine: function (x, t, b, c, d) {
|
56 |
-
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
57 |
-
},
|
58 |
-
easeInExpo: function (x, t, b, c, d) {
|
59 |
-
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
60 |
-
},
|
61 |
-
easeOutExpo: function (x, t, b, c, d) {
|
62 |
-
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
63 |
-
},
|
64 |
-
easeInOutExpo: function (x, t, b, c, d) {
|
65 |
-
if (t==0) return b;
|
66 |
-
if (t==d) return b+c;
|
67 |
-
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
68 |
-
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
69 |
-
},
|
70 |
-
easeInCirc: function (x, t, b, c, d) {
|
71 |
-
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
72 |
-
},
|
73 |
-
easeOutCirc: function (x, t, b, c, d) {
|
74 |
-
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
75 |
-
},
|
76 |
-
easeInOutCirc: function (x, t, b, c, d) {
|
77 |
-
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
78 |
-
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
79 |
-
},
|
80 |
-
easeInElastic: function (x, t, b, c, d) {
|
81 |
-
var s=1.70158;var p=0;var a=c;
|
82 |
-
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
83 |
-
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
84 |
-
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
85 |
-
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
86 |
-
},
|
87 |
-
easeOutElastic: function (x, t, b, c, d) {
|
88 |
-
var s=1.70158;var p=0;var a=c;
|
89 |
-
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
90 |
-
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
91 |
-
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
92 |
-
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
93 |
-
},
|
94 |
-
easeInOutElastic: function (x, t, b, c, d) {
|
95 |
-
var s=1.70158;var p=0;var a=c;
|
96 |
-
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
97 |
-
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
98 |
-
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
99 |
-
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
100 |
-
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
101 |
-
},
|
102 |
-
easeInBack: function (x, t, b, c, d, s) {
|
103 |
-
if (s == undefined) s = 1.70158;
|
104 |
-
return c*(t/=d)*t*((s+1)*t - s) + b;
|
105 |
-
},
|
106 |
-
easeOutBack: function (x, t, b, c, d, s) {
|
107 |
-
if (s == undefined) s = 1.70158;
|
108 |
-
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
109 |
-
},
|
110 |
-
easeInOutBack: function (x, t, b, c, d, s) {
|
111 |
-
if (s == undefined) s = 1.70158;
|
112 |
-
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
113 |
-
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
114 |
-
},
|
115 |
-
easeInBounce: function (x, t, b, c, d) {
|
116 |
-
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
117 |
-
},
|
118 |
-
easeOutBounce: function (x, t, b, c, d) {
|
119 |
-
if ((t/=d) < (1/2.75)) {
|
120 |
-
return c*(7.5625*t*t) + b;
|
121 |
-
} else if (t < (2/2.75)) {
|
122 |
-
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
123 |
-
} else if (t < (2.5/2.75)) {
|
124 |
-
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
125 |
-
} else {
|
126 |
-
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
127 |
-
}
|
128 |
-
},
|
129 |
-
easeInOutBounce: function (x, t, b, c, d) {
|
130 |
-
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
131 |
-
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
132 |
-
}
|
133 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/jquery.easing.min.js
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jQuery Easing v1.3.2 - http://gsgd.co.uk/sandbox/jquery/easing/
|
3 |
+
* Open source under the BSD License.
|
4 |
+
* Copyright © 2008 George McGinley Smith
|
5 |
+
* All rights reserved.
|
6 |
+
* https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
|
7 |
+
*/
|
8 |
+
(function(h){h.easing.jswing=h.easing.swing;h.extend(h.easing,{def:"easeOutQuad",swing:function(e,a,c,b,d){return h.easing[h.easing.def](e,a,c,b,d)},easeInQuad:function(e,a,c,b,d){return b*(a/=d)*a+c},easeOutQuad:function(e,a,c,b,d){return-b*(a/=d)*(a-2)+c},easeInOutQuad:function(e,a,c,b,d){return 1>(a/=d/2)?b/2*a*a+c:-b/2*(--a*(a-2)-1)+c},easeInCubic:function(e,a,c,b,d){return b*(a/=d)*a*a+c},easeOutCubic:function(e,a,c,b,d){return b*((a=a/d-1)*a*a+1)+c},easeInOutCubic:function(e,a,c,b,d){return 1>
|
9 |
+
(a/=d/2)?b/2*a*a*a+c:b/2*((a-=2)*a*a+2)+c},easeInQuart:function(e,a,c,b,d){return b*(a/=d)*a*a*a+c},easeOutQuart:function(e,a,c,b,d){return-b*((a=a/d-1)*a*a*a-1)+c},easeInOutQuart:function(e,a,c,b,d){return 1>(a/=d/2)?b/2*a*a*a*a+c:-b/2*((a-=2)*a*a*a-2)+c},easeInQuint:function(e,a,c,b,d){return b*(a/=d)*a*a*a*a+c},easeOutQuint:function(e,a,c,b,d){return b*((a=a/d-1)*a*a*a*a+1)+c},easeInOutQuint:function(e,a,c,b,d){return 1>(a/=d/2)?b/2*a*a*a*a*a+c:b/2*((a-=2)*a*a*a*a+2)+c},easeInSine:function(e,a,
|
10 |
+
c,b,d){return-b*Math.cos(a/d*(Math.PI/2))+b+c},easeOutSine:function(e,a,c,b,d){return b*Math.sin(a/d*(Math.PI/2))+c},easeInOutSine:function(e,a,c,b,d){return-b/2*(Math.cos(Math.PI*a/d)-1)+c},easeInExpo:function(e,a,c,b,d){return 0==a?c:b*Math.pow(2,10*(a/d-1))+c},easeOutExpo:function(e,a,c,b,d){return a==d?c+b:b*(-Math.pow(2,-10*a/d)+1)+c},easeInOutExpo:function(e,a,c,b,d){return 0==a?c:a==d?c+b:1>(a/=d/2)?b/2*Math.pow(2,10*(a-1))+c:b/2*(-Math.pow(2,-10*--a)+2)+c},easeInCirc:function(e,a,c,b,d){return-b*
|
11 |
+
(Math.sqrt(1-(a/=d)*a)-1)+c},easeOutCirc:function(e,a,c,b,d){return b*Math.sqrt(1-(a=a/d-1)*a)+c},easeInOutCirc:function(e,a,c,b,d){return 1>(a/=d/2)?-b/2*(Math.sqrt(1-a*a)-1)+c:b/2*(Math.sqrt(1-(a-=2)*a)+1)+c},easeInElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(0==a)return c;if(1==(a/=d))return c+b;f||(f=.3*d);g<Math.abs(b)?(g=b,e=f/4):e=f/(2*Math.PI)*Math.asin(b/g);return-(g*Math.pow(2,10*--a)*Math.sin(2*(a*d-e)*Math.PI/f))+c},easeOutElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(0==
|
12 |
+
a)return c;if(1==(a/=d))return c+b;f||(f=.3*d);g<Math.abs(b)?(g=b,e=f/4):e=f/(2*Math.PI)*Math.asin(b/g);return g*Math.pow(2,-10*a)*Math.sin(2*(a*d-e)*Math.PI/f)+b+c},easeInOutElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(0==a)return c;if(2==(a/=d/2))return c+b;f||(f=.3*d*1.5);g<Math.abs(b)?(g=b,e=f/4):e=f/(2*Math.PI)*Math.asin(b/g);return 1>a?-.5*g*Math.pow(2,10*--a)*Math.sin(2*(a*d-e)*Math.PI/f)+c:g*Math.pow(2,-10*--a)*Math.sin(2*(a*d-e)*Math.PI/f)*.5+b+c},easeInBack:function(e,a,c,b,d,f){void 0==
|
13 |
+
f&&(f=1.70158);return b*(a/=d)*a*((f+1)*a-f)+c},easeOutBack:function(e,a,c,b,d,f){void 0==f&&(f=1.70158);return b*((a=a/d-1)*a*((f+1)*a+f)+1)+c},easeInOutBack:function(e,a,c,b,d,f){void 0==f&&(f=1.70158);return 1>(a/=d/2)?b/2*a*a*(((f*=1.525)+1)*a-f)+c:b/2*((a-=2)*a*(((f*=1.525)+1)*a+f)+2)+c},easeInBounce:function(e,a,c,b,d){return b-h.easing.easeOutBounce(e,d-a,0,b,d)+c},easeOutBounce:function(e,a,c,b,d){return(a/=d)<1/2.75?7.5625*b*a*a+c:a<2/2.75?b*(7.5625*(a-=1.5/2.75)*a+.75)+c:a<2.5/2.75?b*(7.5625*
|
14 |
+
(a-=2.25/2.75)*a+.9375)+c:b*(7.5625*(a-=2.625/2.75)*a+.984375)+c},easeInOutBounce:function(e,a,c,b,d){return a<d/2?.5*h.easing.easeInBounce(e,2*a,0,b,d)+c:.5*h.easing.easeOutBounce(e,2*a-d,0,b,d)+.5*b+c}})})(jQuery);
|
js/jquery.mousewheel.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
(function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery)
|
|
js/jquery.simplr.smoothscroll.js
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* jquery.simplr.smoothscroll
|
3 |
-
* version 1.0
|
4 |
-
* copyright (c) 2012 https://github.com/simov/simplr-smoothscroll
|
5 |
-
* licensed under MIT
|
6 |
-
* requires jquery.mousewheel - https://github.com/brandonaaron/jquery-mousewheel/
|
7 |
-
*/
|
8 |
-
|
9 |
-
;(function ($) {
|
10 |
-
'use strict'
|
11 |
-
|
12 |
-
$.srSmoothscroll = function (options) {
|
13 |
-
|
14 |
-
var self = $.extend({
|
15 |
-
step: 55,
|
16 |
-
speed: 400,
|
17 |
-
ease: 'swing',
|
18 |
-
target: $('body'),
|
19 |
-
container: $(window)
|
20 |
-
}, options || {})
|
21 |
-
|
22 |
-
// private fields & init
|
23 |
-
var container = self.container
|
24 |
-
, top = 0
|
25 |
-
, step = self.step
|
26 |
-
, viewport = container.height()
|
27 |
-
, wheel = false
|
28 |
-
|
29 |
-
var target
|
30 |
-
if (self.target.selector == 'body') {
|
31 |
-
target = (navigator.userAgent.indexOf('AppleWebKit') !== -1) ? self.target : $('html')
|
32 |
-
} else {
|
33 |
-
target = container
|
34 |
-
}
|
35 |
-
|
36 |
-
// events
|
37 |
-
self.target.mousewheel(function (event, delta) {
|
38 |
-
|
39 |
-
wheel = true
|
40 |
-
|
41 |
-
if (delta < 0) // down
|
42 |
-
top = (top+viewport) >= self.target.outerHeight(true) ? top : top+=step
|
43 |
-
|
44 |
-
else // up
|
45 |
-
top = top <= 0 ? 0 : top-=step
|
46 |
-
|
47 |
-
target.stop().animate({scrollTop: top}, self.speed, self.ease, function () {
|
48 |
-
wheel = false
|
49 |
-
})
|
50 |
-
|
51 |
-
return false
|
52 |
-
})
|
53 |
-
|
54 |
-
container
|
55 |
-
.on('resize', function (e) {
|
56 |
-
viewport = container.height()
|
57 |
-
})
|
58 |
-
.on('scroll', function (e) {
|
59 |
-
if (!wheel)
|
60 |
-
top = container.scrollTop()
|
61 |
-
})
|
62 |
-
|
63 |
-
}
|
64 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/wpmss.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
jQuery(document).ready(function($) {
|
2 |
-
|
3 |
});
|
4 |
|
5 |
function MouseSmoothScroll(){
|
@@ -7,11 +7,5 @@ function MouseSmoothScroll(){
|
|
7 |
isMac = /(mac)/.exec( window.navigator.userAgent.toLowerCase() );
|
8 |
if( isMac != null && isMac.length ) return false;
|
9 |
<?php endif ?>
|
10 |
-
jQuery.
|
11 |
-
step: <?php echo $_GET['step'] ?>,
|
12 |
-
speed: <?php echo $_GET['speed'] ?>,
|
13 |
-
ease: '<?php echo $_GET['ease'] ?>',
|
14 |
-
target: jQuery('body'),
|
15 |
-
container: jQuery(window)
|
16 |
-
});
|
17 |
}
|
1 |
jQuery(document).ready(function($) {
|
2 |
+
MouseSmoothScroll();
|
3 |
});
|
4 |
|
5 |
function MouseSmoothScroll(){
|
7 |
isMac = /(mac)/.exec( window.navigator.userAgent.toLowerCase() );
|
8 |
if( isMac != null && isMac.length ) return false;
|
9 |
<?php endif ?>
|
10 |
+
jQuery.scrollSpeed(<?php echo $_GET['step'] ?>, <?php echo $_GET['speed'] ?>, '<?php echo $_GET['ease'] ?>');
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
}
|
mousewheel-smooth-scroll.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: MouseWheel Smooth Scroll
|
4 |
Plugin URI: http://kubiq.sk
|
5 |
Description: MouseWheel smooth scrolling for your WordPress website
|
6 |
-
Version: 1.
|
7 |
Author: Jakub Novák
|
8 |
Author URI: http://kubiq.sk
|
9 |
*/
|
@@ -48,16 +48,15 @@ if (!class_exists('wpmss')) {
|
|
48 |
}
|
49 |
|
50 |
function plugin_scripts_load() {
|
51 |
-
wp_enqueue_script( '
|
52 |
-
wp_enqueue_script( 'wpmss_jquery_easing', plugins_url( 'js/jquery.easing.1.3.js' , __FILE__ ));
|
53 |
$options = array(
|
54 |
'step' => isset( $this->settings['general']['step'] ) && trim( $this->settings['general']['step'] ) != "" ? $this->settings['general']['step'] : 120,
|
55 |
'speed' => isset( $this->settings['general']['speed'] ) && trim( $this->settings['general']['step'] ) != "" ? $this->settings['general']['speed'] : 800,
|
56 |
'ease' => isset( $this->settings['general']['ease'] ) ? $this->settings['general']['ease'] : 'easeOutCubic',
|
57 |
'enableAll' => isset( $this->settings['general']['enable_mac'] ) ? 1 : 0
|
58 |
);
|
59 |
-
wp_enqueue_script( '
|
60 |
-
wp_enqueue_script( 'wpmss_script', plugins_url( 'js/wpmss.php?'.http_build_query($options)
|
61 |
}
|
62 |
|
63 |
function plugin_admin_tabs( $current = 'general' ) {
|
3 |
Plugin Name: MouseWheel Smooth Scroll
|
4 |
Plugin URI: http://kubiq.sk
|
5 |
Description: MouseWheel smooth scrolling for your WordPress website
|
6 |
+
Version: 1.2
|
7 |
Author: Jakub Novák
|
8 |
Author URI: http://kubiq.sk
|
9 |
*/
|
48 |
}
|
49 |
|
50 |
function plugin_scripts_load() {
|
51 |
+
wp_enqueue_script( 'wpmss_jquery_easing', plugins_url( 'js/jquery.easing.min.js', __FILE__ ), array('jquery'));
|
|
|
52 |
$options = array(
|
53 |
'step' => isset( $this->settings['general']['step'] ) && trim( $this->settings['general']['step'] ) != "" ? $this->settings['general']['step'] : 120,
|
54 |
'speed' => isset( $this->settings['general']['speed'] ) && trim( $this->settings['general']['step'] ) != "" ? $this->settings['general']['speed'] : 800,
|
55 |
'ease' => isset( $this->settings['general']['ease'] ) ? $this->settings['general']['ease'] : 'easeOutCubic',
|
56 |
'enableAll' => isset( $this->settings['general']['enable_mac'] ) ? 1 : 0
|
57 |
);
|
58 |
+
wp_enqueue_script( 'wpmss_scrollSpeed', plugins_url( 'js/jQuery.scrollSpeed.js', __FILE__ ), array('jquery'));
|
59 |
+
wp_enqueue_script( 'wpmss_script', plugins_url( 'js/wpmss.php?'.http_build_query($options), __FILE__ ), array('jquery'));
|
60 |
}
|
61 |
|
62 |
function plugin_admin_tabs( $current = 'general' ) {
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: kubiq
|
|
3 |
Donate link: http://kubiq.sk
|
4 |
Tags: smooth scroll, mousewheel scroll, scrolling
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -49,4 +49,10 @@ Replace basic scrolling "effect" on Windows, Linux and some browsers with nice s
|
|
49 |
* Remove some script
|
50 |
|
51 |
= 1.1 =
|
52 |
-
* Tested on WP 4.2
|
|
|
|
|
|
|
|
|
|
|
|
3 |
Donate link: http://kubiq.sk
|
4 |
Tags: smooth scroll, mousewheel scroll, scrolling
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 4.4
|
7 |
+
Stable tag: 1.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
49 |
* Remove some script
|
50 |
|
51 |
= 1.1 =
|
52 |
+
* Tested on WP 4.2
|
53 |
+
|
54 |
+
= 1.2 =
|
55 |
+
* Tested on WP 4.4
|
56 |
+
* Use different jQuery library
|
57 |
+
* Repair scripts enqueue dependencies
|
58 |
+
* Ctrl + scroll is now zooming - default browser behaviour
|