-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
59 lines (53 loc) · 1.64 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Svelte Scroller</title>
<style>
* {
box-sizing: border-box;
}
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
.day {
margin: 0 40px;
padding: 0;
font-size: 12em;
}
</style>
</head>
<body>
<scroll-mation id="demoscroll" duration="3000">
<div class="day">
🌞
</div>
</scroll-mation>
<script src="scrollmation.js"></script>
<script src="util.js"></script>
<script>
const demoScroll = document.querySelector('#demoscroll')
demoScroll.duration = 5000
demoScroll.startpos = -80
demoScroll.homepos = 20
demoScroll.endpos = -80
demoScroll.addEventListener("next", (e) => console.log("next"));
demoScroll.addEventListener("prev", (e) => console.log("prev"));
demoScroll.addEventListener("home", (e) => console.log("home"));
demoScroll.addEventListener("scroll", (e) => {
// console.log('toHomeRatio', toHomeRatio(e.detail));
console.log('toStartRatio', toStartRatio(e.detail));
// console.log('toEndRatio', toEndRatio(e.detail));
// console.log('toRangeRatio', toRangeRatio(e.detail));
// console.log('fullRangePx', fullRangePx(e.detail));
// console.log('toHomePx', toHomePx(e.detail));
// console.log('toEndPx', toEndPx(e.detail));
// console.log('toStartPx', toStartPx(e.detail));
});
</script>
</body>
</html>