You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can [download the plugin directly from Github](https://raw.githubusercontent.com/phucbm/jquery-scroll-direction-plugin/main/jquery.scroll-direction.js).
24
+
You
25
+
can [download the plugin directly from Github](https://raw.githubusercontent.com/phucbm/jquery-scroll-direction-plugin/main/jquery.scroll-direction.js)
You can also browse for the latest version by visiting [Scroll Direction on jsDelivr](https://cdn.jsdelivr.net/gh/phucbm/jquery-scroll-direction-plugin/)
35
+
You can also browse for the latest version by
36
+
visiting [Scroll Direction on jsDelivr](https://cdn.jsdelivr.net/gh/phucbm/jquery-scroll-direction-plugin/)
33
37
34
38
```html
35
39
<!-- Scroll Direction - v1.1.0 -->
@@ -53,6 +57,7 @@ $.scrollDirection.init();
53
57
```
54
58
55
59
```html
60
+
56
61
<bodyclass="scroll-top scroll-up"></body>
57
62
```
58
63
@@ -70,7 +75,7 @@ $.scrollDirection.init({
70
75
});
71
76
72
77
// update Scroll Direction on Locomotive scroll event
73
-
scroller.on('scroll', function(obj){
78
+
scroller.on('scroll', function(obj){
74
79
$.scrollDirection.update({
75
80
scrollAmount: () =>obj.scroll.y,
76
81
maxScrollAmount: () =>obj.limit.y,
@@ -108,34 +113,50 @@ $.scrollDirection.init({
108
113
### Update
109
114
110
115
```js
116
+
// jQuery
111
117
$.scrollDirection.update({
112
118
// update new options
113
119
});
120
+
121
+
// Pure JS
122
+
window.scrollDirection.update({
123
+
// update new options
124
+
});
114
125
```
115
126
116
127
### Events
117
128
118
129
```js
130
+
// jQuery
119
131
// this event runs whenever you load, resize and scroll
120
-
$(window).on("scrollDirection", function () {
121
-
// do your job here
132
+
$(window).on("scrollDirection", function(){
133
+
// do your job here
122
134
});
123
135
124
136
// when you scroll up
125
-
$(window).on("scrollUp", function () {});
137
+
$(window).on("scrollUp", function(){
138
+
});
126
139
127
140
// when you scroll down
128
-
$(window).on("scrollDown", function () {});
141
+
$(window).on("scrollDown", function(){
142
+
});
129
143
130
144
// when you at the beginning of the page, you can increase the top zone using topOffset
131
-
$(window).on("scrollAtTop", function () {});
145
+
$(window).on("scrollAtTop", function(){
146
+
});
132
147
133
148
// when you in the middle of the page
134
149
// this means the top and bottom zone are not visible in view port
0 commit comments