-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
315 lines (299 loc) · 9.98 KB
/
index.html
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Smooth scroller JS</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="./Styles/main.css" />
<script src="./Scripts/scroller.js" defer></script>
<script src="./Scripts/scroll-based-animator.js" defer></script>
<script src="./Scripts/sticky.js" defer></script>
</head>
<body>
<main class="scroller-main-cont scrollerY" data-class="main-wrapper">
<div class="hero-sect sect">
<h1>
The smooth <span>-></span> <br />
experience with <br />
all accessibility
</h1>
<p>
A JavaScript smooth scroll library for a better user experience with
all accessibility. A great addition to the modern or luxury classic
brand website.
</p>
<p class="scroll-indicator">Scroll down</p>
</div>
<div class="sub-scroller-main-cont">
<div class="sect">
<div class="box">
<h2>
You can scroll <br />
multiple axis with <br />
single scrollbar.
</h2>
<p>
This is an extra feature specially made for classic and unique
layout design. This helps to create great visual interest on the
website.
</p>
<a href="#showcase-sect1" style="margin-top: 3vw"
>Tab navigation - 1</a
>
</div>
<div class="box my-box">
<h3>
You can remove tab foccus to <br />
a spacific element by giving <br />
the attribute -> tabindex="-1"
</h3>
<a href="#" tabindex="-1">Not tab navigation</a>
</div>
<div class="box" tabindex="1">
<h3>
You can add tab foccus to <br />
a spacific element by giving <br />
the attribute -> tabindex="1"
</h3>
<p>This is Tab navigation - 2</p>
</div>
</div>
</div>
<div class="sect" id="showcase-sect1">
<h2>
You can use four <br />
type of scrollbars.
</h2>
<div class="cont">
<div class="scroller-main-cont scrollerY">
<h3>Scroll only Y axis.</h3>
<a href="#showcase-sect2" style="margin-top: 25vw"
>Tab navigation - 3</a
>
</div>
<div class="scroller-main-cont scrollerX">
<h3>Scroll only X axis.</h3>
<a href="#" style="margin-left: 75vw">Tab navigation - 4</a>
</div>
</div>
<div class="cont">
<div class="scroller-main-cont auto-scrollerX">
<h3>Scroll X by Y scroller.</h3>
<a href="#" style="margin-left: 75vw">Tab navigation - 5</a>
</div>
<div class="scroller-main-cont">
<h3>Scroll both axis.</h3>
<a
href="#"
id="showcase-sect2"
style="margin-left: 75vw; margin-top: 25vw"
>Tab navigation - 6</a
>
</div>
</div>
</div>
<div class="sect">
<h3>
You can use any pointer to scroll the page like a default scroller.
These are scroller wheel, middle mouse button, Tab key, arrow key,
touch etc.
</h3>
<a href="#" style="margin-top: 3vw">Tab navigation - 7</a>
</div>
<div class="sect">
<h2>Parallux simple animation</h2>
<div class="cont-2">
<div class="box-1 parallux-element"></div>
<div class="box-2 parallux-element"></div>
<div class="box-3 parallux-element"></div>
</div>
</div>
<div class="sect">
<h2>Complex animation</h2>
<div class="cont-1">
<div class="sticky">
<div class="box">
<div class="anim-1"></div>
<div class="anim-2"></div>
</div>
</div>
<div class="break-point point1"></div>
<div class="break-point point2"></div>
<div class="break-point point3"></div>
<div class="break-point point4"></div>
<div class="break-point point5"></div>
</div>
</div>
<div class="sect">
<h3>
Very easy to use. Just you will need to add the class to the main
container. All animations are handled by CSS! You can customize the
animation in CSS.
</h3>
</div>
<div class="sect">
<h3>Thanks for your time.</h3>
</div>
</main>
<script>
onload = () => {
const myBox = document.querySelector(".my-box");
const boxEl1 = document.querySelector(".box-1"),
boxEl2 = document.querySelector(".box-2"),
boxEl3 = document.querySelector(".box-3");
const myEl0 = document.querySelector(".cont-1 .box"),
myEl1 = document.querySelector(".anim-1"),
myEl2 = document.querySelector(".anim-2");
const point1 = document.querySelector(".point1"),
point2 = document.querySelector(".point2"),
point3 = document.querySelector(".point3"),
point4 = document.querySelector(".point4"),
point5 = document.querySelector(".point5");
const sbAnimationObjs = [
// Simple animation - 0
{
pointEl: myBox,
axis: "x",
steps: [
() => {
myBox.style.transform = `translateY(0)`;
},
(percentage) => {
myBox.style.transform = `translateY(${7 * percentage}vw)`;
},
() => {
myBox.style.transform = `translateY(7vw)`;
},
],
offsets: [innerWidth / 2, -innerWidth / 4],
},
// Simple animation - 1
{
pointEl: boxEl1,
steps: [
() => {
boxEl1.style.transform = `translateY(0)`;
},
(percentage) => {
boxEl1.style.transform = `translateY(${15 * percentage}vh)`;
},
() => {
boxEl1.style.transform = `translateY(15vh)`;
},
],
},
// Simple animation - 2
{
pointEl: boxEl2,
steps: [
() => {
boxEl2.style.backgroundColor = `rgb(245, 245, 245)`;
},
(percentage) => {
boxEl2.style.backgroundColor = `rgb(${
245 - (245 - 55) * percentage
}, ${245 - (245 - 65) * percentage}, ${
245 - (245 - 145) * percentage
})`;
},
() => {
boxEl2.style.backgroundColor = `rgb(55, 65, 145)`;
},
],
},
// Simple animation - 3
{
pointEl: boxEl3,
steps: [
() => {
boxEl3.style.transform = `translateY(0) rotateZ(0deg)`;
},
(percentage) => {
boxEl3.style.transform = `translateY(${
-15 * percentage
}vh) rotateZ(${90 * percentage}deg)`;
},
() => {
boxEl3.style.transform = `translateY(-15vh) rotateZ(90deg)`;
},
],
offsets: [0, -innerHeight / 2],
},
// Complex animation - 1
{
type: "complex",
startPointEl: point1,
finishPointEl: point2,
steps: [
() => {
myEl1.style.backgroundColor = `rgb(0, 0, 0)`;
},
(percentage) => {
myEl1.style.backgroundColor = `rgb(${15 * percentage}, ${
155 * percentage
}, ${135 * percentage})`;
},
() => {
myEl1.style.backgroundColor = `rgb(15, 155, 135)`;
},
],
},
{
type: "complex",
startPointEl: point2,
finishPointEl: point3,
steps: [
() => {
myEl0.style.transform = `rotateZ(0deg)`;
},
(percentage) => {
myEl0.style.transform = `rotateZ(${90 * percentage}deg)`;
},
() => {
myEl0.style.transform = `rotateZ(90deg)`;
},
],
},
{
type: "complex",
startPointEl: point4,
finishPointEl: point5,
steps: [
() => {
myEl1.style.backgroundColor = `rgb(15, 155, 135)`;
myEl0.style.transform = `rotateZ(90deg)`;
},
(percentage) => {
myEl1.style.backgroundColor = `rgb(${15 - 15 * percentage}, ${
155 - 155 * percentage
}, ${135 - 135 * percentage})`;
myEl0.style.transform = `rotateZ(${90 - 90 * percentage}deg)`;
},
() => {
myEl1.style.backgroundColor = `rgb(0, 0, 0)`;
myEl0.style.transform = `rotateZ(0deg)`;
},
],
offsets: [innerHeight / 2, innerHeight / 2],
},
];
scrollBasedAnimator(sbAnimationObjs);
// Sticky Elements Function
const stkAnimationObjs = [
{
pointEl: document.querySelector(".sticky"),
offsets: [50, 50],
},
];
stickyAnimator(stkAnimationObjs);
};
</script>
</body>
</html>