jos-animation 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/FUNDING.yml +13 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.prettierignore +8 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +18 -0
- package/LEARN.md +3 -0
- package/LICENSE.md +21 -0
- package/README.md +453 -0
- package/SECURITY.md +19 -0
- package/dev/index.html +422 -0
- package/dev/jos.css +647 -0
- package/dev/jos.js +413 -0
- package/dev/scroll.js +18 -0
- package/dist/.htaccess +0 -0
- package/dist/jos.css +1 -0
- package/dist/jos.debug.js +414 -0
- package/dist/jos.js +309 -0
- package/dist/jos.min.js +1 -0
- package/dist/v0.3/jos.css +225 -0
- package/dist/v0.3/jos.js +161 -0
- package/dist/v0.5/jos.css +250 -0
- package/dist/v0.5/jos.js +473 -0
- package/dist/v0.6/jos.css +250 -0
- package/dist/v0.6/jos.debug.js +2 -0
- package/dist/v0.6/jos.debug.min.js +2 -0
- package/dist/v0.6/jos.js +212 -0
- package/dist/v0.6/jos.min.js +2 -0
- package/dist/v0.7/.htaccess +0 -0
- package/dist/v0.7/jos.css +2 -0
- package/dist/v0.7/jos.debug.js +459 -0
- package/dist/v0.7/jos.dev.js +623 -0
- package/dist/v0.7/jos.js +264 -0
- package/dist/v0.7/jos.min.js +2 -0
- package/dist/v0.8/jos.css +1 -0
- package/dist/v0.8/jos.debug.js +414 -0
- package/dist/v0.8/jos.js +309 -0
- package/dist/v0.8/jos.min.js +1 -0
- package/docs/index.html +419 -0
- package/docs/index2.html +678 -0
- package/docs/indexOld.html +291 -0
- package/docs/style.css +216 -0
- package/package.json +31 -0
- package/res/7ygwKRQc_2x.jpg +0 -0
- package/res/NewvWJ8Z_2x.jpg +0 -0
- package/res/asdsad.jpg +0 -0
- package/res/cPowTYfI_2x.jpg +0 -0
- package/res/favicon.ico +0 -0
- package/res/logo.jpg +0 -0
- package/res/logo_1_sq.png +0 -0
- package/res/logo_1png-removebg-preview.png +0 -0
- package/res/logo_1png.png +0 -0
- package/res/logo_2-removebg-preview.png +0 -0
- package/res/logo_2.png +0 -0
- package/res/logo_2_sq.png +0 -0
package/dev/jos.js
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
class jos {
|
|
2
|
+
default_once = false;
|
|
3
|
+
default_animation = "fade";
|
|
4
|
+
default_animationinverse = undefined;
|
|
5
|
+
default_timingFunction = "ease-in-out";
|
|
6
|
+
default_threshold = 0;
|
|
7
|
+
default_duration = 0.4;
|
|
8
|
+
default_delay = 0;
|
|
9
|
+
default_intersectionRatio = 0;
|
|
10
|
+
default_rootMargin = "-10% 0% -40% 0%";
|
|
11
|
+
default_startVisible = undefined;
|
|
12
|
+
default_scrolldirection = undefined;
|
|
13
|
+
default_passive = true;
|
|
14
|
+
|
|
15
|
+
debug = false;
|
|
16
|
+
disable = false;
|
|
17
|
+
|
|
18
|
+
static version = "0.8.4 (Development)";
|
|
19
|
+
static author = "Jesvi Jonathan";
|
|
20
|
+
static github = "https://github.com/jesvijonathan/JOS-Animation-Library";
|
|
21
|
+
|
|
22
|
+
options = {};
|
|
23
|
+
jos_stylesheet = undefined;
|
|
24
|
+
boxes = undefined;
|
|
25
|
+
observers = [];
|
|
26
|
+
|
|
27
|
+
constructor() {}
|
|
28
|
+
|
|
29
|
+
version() {
|
|
30
|
+
console.log(`JOS: Javascript On Scroll Animation Library
|
|
31
|
+
- Version: ${jos.version}
|
|
32
|
+
- Author: ${jos.author}
|
|
33
|
+
- Github: ${jos.github}\n`);
|
|
34
|
+
}
|
|
35
|
+
//debugger = () => null;
|
|
36
|
+
debugger(type = 0) {
|
|
37
|
+
if (type == 0 && this.debugMode) {
|
|
38
|
+
this.version();
|
|
39
|
+
console.log(`JOS Settings:
|
|
40
|
+
- animation: ${this.default_animation}
|
|
41
|
+
- once: ${this.default_once}
|
|
42
|
+
- animationinverse: ${this.default_animationinverse}
|
|
43
|
+
- timingFunction: ${this.default_timingFunction}
|
|
44
|
+
- duration: ${this.default_duration}
|
|
45
|
+
- delay: ${this.default_delay}
|
|
46
|
+
- threshold: ${this.default_threshold}
|
|
47
|
+
- startVisible: ${this.default_startVisible}
|
|
48
|
+
- scrolldirection: ${this.default_scrolldirection}
|
|
49
|
+
- intersectionRatio: ${this.default_intersectionRatio}
|
|
50
|
+
- rootMargin: ${this.default_rootMargin}
|
|
51
|
+
- disable: ${this.disable}
|
|
52
|
+
- debugMode: ${this.debugMode}\n`);
|
|
53
|
+
}
|
|
54
|
+
console.log("JOS Initialized:\n\n");
|
|
55
|
+
if ((type == 1 || type == 0) && this.debugMode) {
|
|
56
|
+
console.log(this.boxes || "No Elements Found");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
callbackRouter_anchor = (entries, observer) => {
|
|
61
|
+
let entry = entries[0];
|
|
62
|
+
let parentTarget = entry.target;
|
|
63
|
+
let elem = document.querySelectorAll(
|
|
64
|
+
"[data-jos_anchor='#" + parentTarget.id + "']"
|
|
65
|
+
);
|
|
66
|
+
elem.forEach((target) => {
|
|
67
|
+
let target_jos_animation = target.dataset.jos_animation;
|
|
68
|
+
let target_jos_animationinverse = target.dataset.jos_animationinverse;
|
|
69
|
+
let scroll_dir = 1;
|
|
70
|
+
if (entry.isIntersecting) {
|
|
71
|
+
if (target.dataset.jos_counter != undefined) {
|
|
72
|
+
let counter_value = parseInt(target.dataset.jos_counter);
|
|
73
|
+
counter_value++;
|
|
74
|
+
target.dataset.jos_counter = counter_value;
|
|
75
|
+
}
|
|
76
|
+
if (target_jos_animation) {
|
|
77
|
+
target.classList.remove("jos-" + target_jos_animation);
|
|
78
|
+
if (target.dataset.jos_invoke != undefined) {
|
|
79
|
+
window[target.dataset.jos_invoke](target);
|
|
80
|
+
}
|
|
81
|
+
if (
|
|
82
|
+
target.dataset.jos_once != undefined ||
|
|
83
|
+
target.dataset.jos_once != "false"
|
|
84
|
+
) {
|
|
85
|
+
if (target.dataset.jos_once == "true") {
|
|
86
|
+
observer.unobserve(target);
|
|
87
|
+
} else if (target.dataset.jos_counter >= target.dataset.jos_once) {
|
|
88
|
+
observer.unobserve(target);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (target_jos_animationinverse != undefined) {
|
|
92
|
+
target.classList.add("jos-" + target_jos_animationinverse);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
if (
|
|
97
|
+
target.dataset.jos_scrolldirection === undefined ||
|
|
98
|
+
(scroll_dir === 1 && target.dataset.jos_scrolldirection === "down") ||
|
|
99
|
+
(scroll_dir === 0 && target.dataset.jos_scrolldirection === "up") ||
|
|
100
|
+
target.dataset.jos_scrolldirection === "none"
|
|
101
|
+
) {
|
|
102
|
+
target.classList.add("jos-" + target_jos_animation);
|
|
103
|
+
if (target.dataset.jos_invoke_out !== undefined) {
|
|
104
|
+
window[target.dataset.jos_invoke_out](target);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
callbackRouter = (entries, observer, type = 1) => {
|
|
112
|
+
if (this.disable == true) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
let entry = entries[0];
|
|
116
|
+
let target = entry.target;
|
|
117
|
+
let target_jos_animation = target.dataset.jos_animation;
|
|
118
|
+
let target_jos_animationinverse = target.dataset.jos_animationinverse;
|
|
119
|
+
let scroll_dir = 1;
|
|
120
|
+
if (entry.boundingClientRect.top < 0) {
|
|
121
|
+
scroll_dir = 0;
|
|
122
|
+
} else {
|
|
123
|
+
scroll_dir = 1;
|
|
124
|
+
}
|
|
125
|
+
if (entry.isIntersecting) {
|
|
126
|
+
if (target.dataset.jos_counter != undefined) {
|
|
127
|
+
let counter_value = parseInt(target.dataset.jos_counter);
|
|
128
|
+
counter_value++;
|
|
129
|
+
target.dataset.jos_counter = counter_value;
|
|
130
|
+
}
|
|
131
|
+
if (target_jos_animation) {
|
|
132
|
+
target.classList.remove("jos-" + target_jos_animation);
|
|
133
|
+
if (target.dataset.jos_invoke != undefined) {
|
|
134
|
+
window[target.dataset.jos_invoke](target);
|
|
135
|
+
}
|
|
136
|
+
if (
|
|
137
|
+
target.dataset.jos_once != undefined ||
|
|
138
|
+
target.dataset.jos_once != "false"
|
|
139
|
+
) {
|
|
140
|
+
if (target.dataset.jos_once == "true") {
|
|
141
|
+
observer.unobserve(target);
|
|
142
|
+
} else if (target.dataset.jos_counter >= target.dataset.jos_once) {
|
|
143
|
+
observer.unobserve(target);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (target_jos_animationinverse != undefined) {
|
|
148
|
+
target.classList.add("jos-" + target_jos_animationinverse);
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
if (
|
|
152
|
+
target.dataset.jos_scrolldirection === undefined ||
|
|
153
|
+
(scroll_dir === 1 && target.dataset.jos_scrolldirection === "down") ||
|
|
154
|
+
(scroll_dir === 0 && target.dataset.jos_scrolldirection === "up") ||
|
|
155
|
+
target.dataset.jos_scrolldirection === "none"
|
|
156
|
+
) {
|
|
157
|
+
target.classList.add("jos-" + target_jos_animation);
|
|
158
|
+
if (target_jos_animationinverse != undefined) {
|
|
159
|
+
target.classList.remove("jos-" + target_jos_animationinverse);
|
|
160
|
+
}
|
|
161
|
+
if (target.dataset.jos_invoke_out !== undefined) {
|
|
162
|
+
window[target.dataset.jos_invoke_out](target);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
animationInit() {
|
|
169
|
+
let doit = [];
|
|
170
|
+
this.boxes.forEach((box) => {
|
|
171
|
+
let object_default_once = box.dataset.jos_once;
|
|
172
|
+
let object_default_animation =
|
|
173
|
+
box.dataset.jos_animation || this.default_animation;
|
|
174
|
+
let object_default_animationinverse = box.dataset.jos_animationinverse;
|
|
175
|
+
let object_default_timingFunction = box.dataset.jos_timingFunction;
|
|
176
|
+
let object_default_duration = box.dataset.jos_duration;
|
|
177
|
+
let object_default_delay = box.dataset.jos_delay;
|
|
178
|
+
if (box.classList.contains("jos_disabled")) {
|
|
179
|
+
box.classList.remove("jos_disabled");
|
|
180
|
+
box.classList.add("jos");
|
|
181
|
+
}
|
|
182
|
+
if (
|
|
183
|
+
object_default_once &&
|
|
184
|
+
(object_default_once == "true" || /^\d+$/.test(object_default_once))
|
|
185
|
+
) {
|
|
186
|
+
box.setAttribute("data-jos_once", object_default_once);
|
|
187
|
+
} else {
|
|
188
|
+
box.setAttribute("data-jos_once", this.default_once ? "1" : "false");
|
|
189
|
+
}
|
|
190
|
+
box.setAttribute("data-jos_animation", object_default_animation);
|
|
191
|
+
if (object_default_animationinverse) {
|
|
192
|
+
box.setAttribute(
|
|
193
|
+
"data-jos_animationinverse",
|
|
194
|
+
object_default_animationinverse
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
if (object_default_timingFunction) {
|
|
198
|
+
box.setAttribute(
|
|
199
|
+
"data-jos_timingFunction",
|
|
200
|
+
object_default_timingFunction
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
if (object_default_duration) {
|
|
204
|
+
box.setAttribute("data-jos_duration", object_default_duration);
|
|
205
|
+
}
|
|
206
|
+
if (object_default_delay) {
|
|
207
|
+
box.setAttribute("data-jos_delay", object_default_delay);
|
|
208
|
+
}
|
|
209
|
+
box.setAttribute("data-jos_counter", "0");
|
|
210
|
+
box.classList.add("jos-" + object_default_animation);
|
|
211
|
+
if (box.dataset.jos_startvisible || this.default_startVisible) {
|
|
212
|
+
doit.push(box);
|
|
213
|
+
}
|
|
214
|
+
if (this.default_scrolldirection) {
|
|
215
|
+
box.setAttribute(
|
|
216
|
+
"data-jos_scrolldirection",
|
|
217
|
+
this.default_scrolldirection
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
let rootMargin = [
|
|
221
|
+
box.dataset.jos_rootmargin_top || this.default_rootMargin.split(" ")[0],
|
|
222
|
+
box.dataset.jos_rootmargin_left ||
|
|
223
|
+
this.default_rootMargin.split(" ")[3],
|
|
224
|
+
box.dataset.jos_rootmargin_bottom ||
|
|
225
|
+
this.default_rootMargin.split(" ")[2],
|
|
226
|
+
box.dataset.jos_rootmargin_left ||
|
|
227
|
+
this.default_rootMargin.split(" ")[1],
|
|
228
|
+
].join(" ");
|
|
229
|
+
let box_observer = {
|
|
230
|
+
rootMargin,
|
|
231
|
+
threshold: this.default_threshold,
|
|
232
|
+
passive: this.default_passive,
|
|
233
|
+
};
|
|
234
|
+
if (box.dataset.jos_anchor) {
|
|
235
|
+
const observer = new IntersectionObserver(
|
|
236
|
+
this.callbackRouter_anchor,
|
|
237
|
+
box_observer
|
|
238
|
+
);
|
|
239
|
+
this.observers.push(observer);
|
|
240
|
+
observer.observe(
|
|
241
|
+
document.getElementById(box.dataset.jos_anchor.substring(1))
|
|
242
|
+
);
|
|
243
|
+
} else {
|
|
244
|
+
const observer = new IntersectionObserver(
|
|
245
|
+
this.callbackRouter,
|
|
246
|
+
box_observer
|
|
247
|
+
);
|
|
248
|
+
this.observers.push(observer);
|
|
249
|
+
observer.observe(box);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
setTimeout(() => {
|
|
253
|
+
doit.forEach((box) => {
|
|
254
|
+
let box_time = box.dataset.jos_startvisible;
|
|
255
|
+
setTimeout(() => {
|
|
256
|
+
if (box_time == "true") {
|
|
257
|
+
box_time = 0;
|
|
258
|
+
}
|
|
259
|
+
box.classList.remove("jos-" + box.dataset.jos_animation);
|
|
260
|
+
}, box_time || this.default_startVisible);
|
|
261
|
+
});
|
|
262
|
+
}, 100);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
animationUnset(state = 0) {
|
|
266
|
+
if (state != -1) {
|
|
267
|
+
this.boxes?.forEach((box) => {
|
|
268
|
+
box.classList.remove("jos");
|
|
269
|
+
box.classList.add("jos_disabled");
|
|
270
|
+
if (state == 0) {
|
|
271
|
+
box.classList.add("jos-" + box.dataset.jos_animation);
|
|
272
|
+
} else {
|
|
273
|
+
box.classList.remove("jos-" + box.dataset.jos_animation);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
this.observers?.forEach((observer) => observer.disconnect());
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
getstylesheet() {
|
|
281
|
+
if (!this.jos_stylesheet) {
|
|
282
|
+
this.jos_stylesheet = document.getElementById("jos-stylesheet").sheet;
|
|
283
|
+
}
|
|
284
|
+
this.jos_stylesheet.insertRule(
|
|
285
|
+
".jos {" +
|
|
286
|
+
("transition: " +
|
|
287
|
+
this.default_duration +
|
|
288
|
+
"s " +
|
|
289
|
+
this.default_timingFunction +
|
|
290
|
+
" " +
|
|
291
|
+
this.default_delay +
|
|
292
|
+
"s !important;") +
|
|
293
|
+
"}"
|
|
294
|
+
);
|
|
295
|
+
return this.jos_stylesheet;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
getBoxes() {
|
|
299
|
+
this.boxes = undefined;
|
|
300
|
+
|
|
301
|
+
if (!this.boxes) {
|
|
302
|
+
this.boxes = document.querySelectorAll(".jos");
|
|
303
|
+
}
|
|
304
|
+
return this.boxes;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
getdefault(options = {}) {
|
|
308
|
+
let {
|
|
309
|
+
once,
|
|
310
|
+
animation,
|
|
311
|
+
animationinverse,
|
|
312
|
+
timingFunction,
|
|
313
|
+
threshold,
|
|
314
|
+
startVisible,
|
|
315
|
+
scrollDirection,
|
|
316
|
+
intersectionRatio,
|
|
317
|
+
duration,
|
|
318
|
+
delay,
|
|
319
|
+
debugMode,
|
|
320
|
+
disable,
|
|
321
|
+
rootMargin,
|
|
322
|
+
rootMarginTop,
|
|
323
|
+
rootMarginBottom,
|
|
324
|
+
} = options;
|
|
325
|
+
this.default_once = once || this.default_once;
|
|
326
|
+
this.default_animation = animation || this.default_animation;
|
|
327
|
+
this.default_animationinverse = animationinverse || this.default_animation;
|
|
328
|
+
this.default_timingFunction = timingFunction || this.default_timingFunction;
|
|
329
|
+
this.default_threshold = threshold || this.default_threshold;
|
|
330
|
+
this.default_startVisible = startVisible || this.default_startVisible;
|
|
331
|
+
this.default_scrolldirection =
|
|
332
|
+
scrollDirection || this.default_scrolldirection;
|
|
333
|
+
this.default_intersectionRatio =
|
|
334
|
+
intersectionRatio || this.default_threshold;
|
|
335
|
+
this.default_duration = duration || this.default_duration;
|
|
336
|
+
this.default_delay = delay || this.default_delay;
|
|
337
|
+
this.debugMode = debugMode || this.debugMode;
|
|
338
|
+
this.disable = disable || this.disable;
|
|
339
|
+
this.default_rootMargin =
|
|
340
|
+
rootMargin ||
|
|
341
|
+
`${rootMarginTop || "-10%"} 0% ${rootMarginBottom || "-40%"} 0%`;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
init(options = this.options) {
|
|
345
|
+
this.options = options;
|
|
346
|
+
this.getdefault(options);
|
|
347
|
+
this.getstylesheet();
|
|
348
|
+
this.getBoxes();
|
|
349
|
+
if (this.debugMode) {
|
|
350
|
+
this.debugger();
|
|
351
|
+
}
|
|
352
|
+
if (this.disable) {
|
|
353
|
+
this.stop();
|
|
354
|
+
} else {
|
|
355
|
+
this.start();
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
start(state = 0) {
|
|
360
|
+
// 0 - Normal/Full Start
|
|
361
|
+
// -1 - Resume with current state
|
|
362
|
+
if (state != -1) {
|
|
363
|
+
this.stop();
|
|
364
|
+
this.animationInit();
|
|
365
|
+
}
|
|
366
|
+
this.disable = false;
|
|
367
|
+
return "Started";
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
stop(state = 0) {
|
|
371
|
+
if (state == 1) {
|
|
372
|
+
state = 0;
|
|
373
|
+
} else if (state == 0) {
|
|
374
|
+
state = 1;
|
|
375
|
+
}
|
|
376
|
+
// 0 - Stop | final state | opacity 1
|
|
377
|
+
// 1 - Stop | blank | opacity 0
|
|
378
|
+
// -1 - Pause | final state of elements in viewport
|
|
379
|
+
this.disable = true;
|
|
380
|
+
if (state != -1) {
|
|
381
|
+
this.animationUnset(state);
|
|
382
|
+
}
|
|
383
|
+
return "Stopped";
|
|
384
|
+
}
|
|
385
|
+
refresh() {
|
|
386
|
+
this.animationUnset(-1);
|
|
387
|
+
this.boxes = undefined;
|
|
388
|
+
this.getBoxes();
|
|
389
|
+
this.animationInit();
|
|
390
|
+
this.debugger(1);
|
|
391
|
+
return "Refreshed";
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
destroy(state = 0) {
|
|
395
|
+
// 0 - dont remove stylesheet | To preseve state
|
|
396
|
+
// 1 - remove along with stylesheet & jos stylesheet reference
|
|
397
|
+
this.animationUnset(-1);
|
|
398
|
+
this.boxes = undefined;
|
|
399
|
+
this.observers = [];
|
|
400
|
+
if (state == 1) {
|
|
401
|
+
this.jos_stylesheet.disabled = true;
|
|
402
|
+
}
|
|
403
|
+
this.jos_stylesheet = undefined;
|
|
404
|
+
for (let prop in this) {
|
|
405
|
+
if (this.hasOwnProperty(prop) && typeof this[prop] !== "function") {
|
|
406
|
+
this[prop] = undefined;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
Object.setPrototypeOf(this, null);
|
|
410
|
+
return "JOS Instance Nuked";
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
const JOS = new jos();
|
package/dev/scroll.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const updateScrollPercentage = function () {
|
|
2
|
+
const heightOfWindow = window.innerHeight,
|
|
3
|
+
contentScrolled = window.pageYOffset,
|
|
4
|
+
bodyHeight = document.body.offsetHeight,
|
|
5
|
+
percentage = document.querySelector("[data-scrollPercentage] .percentage");
|
|
6
|
+
percentageVal = document.querySelector("#percentage-value");
|
|
7
|
+
|
|
8
|
+
if (bodyHeight - contentScrolled <= heightOfWindow) {
|
|
9
|
+
percentageVal.textContent = percentage.style.width = "100%";
|
|
10
|
+
} else {
|
|
11
|
+
const total = bodyHeight - heightOfWindow,
|
|
12
|
+
got = contentScrolled,
|
|
13
|
+
percent = parseInt((got / total) * 100);
|
|
14
|
+
percentageVal.textContent = percentage.style.width = percent + "%";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
window.addEventListener("scroll", updateScrollPercentage);
|
package/dist/.htaccess
ADDED
|
File without changes
|
package/dist/jos.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.jos,.jos-anchor{transition:transform ease-in-out,opacity .5s ease-in-out}.jos{opacity:1;display:block}.jos-anchor{opacity:0}.jos-static{transform:translate(0,0);opacity:1}.jos-fade{opacity:0}.jos-fade-right{opacity:0;transform:translateX(-100px)}.jos-fade-left{opacity:0;transform:translateX(100px)}.jos-fade-up{opacity:0;transform:translateY(50px)}.jos-fade-down{opacity:0;transform:translateY(-50px)}.jos-fade-right-up{opacity:0;transform:translateX(-100px) translateY(50px)}.jos-fade-right-down{opacity:0;transform:translateX(-100px) translateY(-50px)}.jos-fade-left-up{opacity:0;transform:translateX(100px) translateY(50px)}.jos-fade-left-down{opacity:0;transform:translateX(100px) translateY(-50px)}.jos-slide,.jos-slide-right{transform:translateX(-100px)}.jos-slide-left{transform:translateX(100px)}.jos-slide-up{transform:translateY(100px)}.jos-slide-down{transform:translateY(-100px)}.jos-slide-right-up{transform:translateX(-100px) translateY(100px)}.jos-slide-right-down{transform:translateX(-100px) translateY(-100px)}.jos-slide-left-up{transform:translateX(100px) translateY(100px)}.jos-slide-left-down{transform:translateX(100px) translateY(-100px)}.jos-zoom,.jos-zoom-out{opacity:0;transform:scale(.8)}.jos-zoom-out-right,.jos-zoom-right{opacity:0;transform:scale(.8) translate3d(-100px,0,-100px)}.jos-zoom-left,.jos-zoom-out-left{opacity:0;transform:scale(.8) translate3d(100px,0,-100px)}.jos-zoom-down,.jos-zoom-out-down{opacity:0;transform:scale(.8) translate3d(0,-100px,0)}.jos-zoom-out-up,.jos-zoom-up{opacity:0;transform:scale(.8) translate3d(0,100px,0)}.jos-grow{transform:scale(0)}.jos-grow-right{transform:scale(0) translate3d(-100px,0,-100px)}.jos-grow-left{transform:scale(0) translate3d(100px,0,-100px)}.jos-grow-down{transform:scale(0) translate3d(0,-100px,0)}.jos-grow-up{transform:scale(0) translate3d(0,100px,0)}.jos-zoom-in{opacity:0;transform:scale(1.1)}.jos-zoom-in-down{opacity:0;transform:scale(1.1) translate3d(0,-100px,0)}.jos-zoom-in-up{opacity:0;transform:scale(1.1) translate3d(0,100px,0)}.jos-zoom-in-right{opacity:0;transform:scale(1.1) translate3d(-100px,0,-100px)}.jos-zoom-in-left{opacity:0;transform:scale(1.1) translate3d(100px,0,-100px)}.jos-shrink{transform:scale(1.4)}.jos-shrink-right{transform:scale(1.4) translate3d(-100px,0,-100px)}.jos-shrink-left{transform:scale(1.4) translate3d(100px,0,-100px)}.jos-shrink-down{transform:scale(1.4) translate3d(0,-100px,0)}.jos-shrink-up{transform:scale(1.4) translate3d(0,100px,0)}.jos-flip,.jos-flip-right{transform:perspective(2500px) rotateY(-100deg);opacity:0}.jos-flip-left{transform:perspective(2500px) rotateY(100deg);opacity:0}.jos-flip-up{opacity:0;transform:perspective(2500px) rotateX(-100deg)}.jos-flip-down{opacity:0;transform:perspective(2500px) rotateX(100deg)}.jos-rotate,.jos-rotate-right{opacity:0;transform:rotate(-180deg)}.jos-rotate-left{opacity:0;transform:rotate(180deg)}.jos-spin,.jos-spin-right{opacity:0;transform:rotate(-180deg) scale(0)}.jos-spin-left{opacity:0;transform:rotate(180deg) scale(0)}.jos-revolve,.jos-revolve-right{opacity:0;transform:rotate(-360deg) scale(0)}.jos-revolve-left{opacity:0;transform:rotate(360deg) scale(0)}.jos-stretch{opacity:0;transform:scaleX(0)}.jos-stretch-vertical{opacity:0;transform:scaleY(0)}[data-jos_pow="0.1"]{transform:rotateY(calc(.1 * 360deg))}[data-jos_pow="0.2"]{transform:rotateY(calc(.2 * 360deg))}[data-jos_pow="0.3"]{transform:rotateY(calc(.3 * 360deg))}[data-jos_pow="0.4"]{transform:rotateY(calc(.4 * 360deg))}[data-jos_pow="0.5"]{transform:rotateY(calc(.5 * 360deg))}[data-jos_pow="0.6"]{transform:rotateY(calc(.6 * 360deg))}[data-jos_pow="0.7"]{transform:rotateY(calc(.7 * 360deg))}[data-jos_pow="0.8"]{transform:rotateY(calc(.8 * 360deg))}[data-jos_pow="0.9"]{transform:rotateY(calc(.9 * 360deg))}[data-jos_pow="1"]{transform:rotateY(calc(1 * 360deg))}[data-jos_timing_function=ease]{transition-timing-function:ease!important}[data-jos_timing_function=ease-in]{transition-timing-function:ease-in!important}[data-jos_timing_function=ease-out]{transition-timing-function:ease-out!important}[data-jos_timing_function=ease-in-out]{transition-timing-function:ease-in-out!important}[data-jos_timing_function=linear]{transition-timing-function:linear!important}[data-jos_timing_function=cubic-bezier]{transition-timing-function:cubic-bezier(0.1,0.7,1,0.1)!important}[data-jos_timing_function=step-start]{transition-timing-function:step-start!important}[data-jos_timing_function=step-end]{transition-timing-function:step-end!important}[data-jos_timing_function=steps]{transition-timing-function:steps(5,end)!important}[data-jos_timing_function=frames]{transition-timing-function:frames(5)!important}[data-jos_timing_function=initial]{transition-timing-function:initial!important}[data-jos_timing_function=inherit]{transition-timing-function:inherit!important}[data-jos_timing_function=unset]{transition-timing-function:unset!important}[data-jos_duration="0.1"]{transition-duration:.1s!important}[data-jos_duration="0.2"]{transition-duration:.2s!important}[data-jos_duration="0.3"]{transition-duration:.3s!important}[data-jos_duration="0.4"]{transition-duration:.4s!important}[data-jos_duration="0.5"]{transition-duration:.5s!important}[data-jos_duration="0.6"]{transition-duration:.6s!important}[data-jos_duration="0.7"]{transition-duration:.7s!important}[data-jos_duration="0.8"]{transition-duration:.8s!important}[data-jos_duration="0.9"]{transition-duration:.9s!important}[data-jos_duration="1"],[data-jos_duration="6"]{transition-duration:1s!important}[data-jos_duration="2"],[data-jos_duration="7"]{transition-duration:2s!important}[data-jos_duration="3"],[data-jos_duration="8"]{transition-duration:3s!important}[data-jos_duration="4"],[data-jos_duration="9"]{transition-duration:4s!important}[data-jos_duration="10"],[data-jos_duration="5"]{transition:5s!important}[data-jos_delay="0.1"]{transition-delay:0.1s!important}[data-jos_delay="0.2"]{transition-delay:0.2s!important}[data-jos_delay="0.3"]{transition-delay:0.3s!important}[data-jos_delay="0.4"]{transition-delay:0.4s!important}[data-jos_delay="0.5"]{transition-delay:0.5s!important}[data-jos_delay="0.6"]{transition-delay:0.6s!important}[data-jos_delay="0.7"]{transition-delay:0.7s!important}[data-jos_delay="0.8"]{transition-delay:0.8s!important}[data-jos_delay="0.9"]{transition-delay:0.9s!important}[data-jos_delay="1"]{transition-delay:1s!important}[data-jos_delay="2"]{transition-delay:2s!important}[data-jos_delay="3"]{transition-delay:3s!important}[data-jos_delay="4"]{transition-delay:4s!important}[data-jos_delay="5"]{transition-delay:5s!important}/* JOS By Jesvi Jonathan */
|