-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathjquery.html
71 lines (71 loc) · 2.35 KB
/
jquery.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
<!DOCTYPE html>
<html lang="us">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<title>Sticksy.js - JQuery usage</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<header class="header">
<div class="container">Move down ↓</div>
</header>
<div class="container">
<div class="content">
<main>
<article>
<div class="title"></div>
<div style="width: 55%" class="title"></div>
<br>
<br>
<div class="image">
<div class="mountain"></div>
<div class="mountain"></div>
<div class="sun"></div>
</div>
<div class="text"></div>
<div class="text"></div>
<div class="text"></div>
<div class="text"></div>
<div class="text"></div>
<div class="text"></div>
<div class="image">
<div class="mountain"></div>
<div class="mountain"></div>
<div class="sun"></div>
</div>
<div class="text"></div>
<div class="text"></div>
<div class="text"></div>
<div class="text"></div>
<div class="image">
<div class="mountain"></div>
<div class="mountain"></div>
<div class="sun"></div>
</div>
<div class="text"></div>
<div class="text"></div>
</article>
</main>
<aside>
<div class="widget"></div>
<div class="widget js-sticky-widget">
STICKY
</div>
<div class="widget"></div>
</aside>
</div>
<footer>End</footer>
<div class="filler">VERY BIG BLOCK</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="../src/sticksy.js"></script>
<script>
var stickyEl = $('.widget.js-sticky-widget').sticksy({topSpacing: 60})[0]
stickyEl.onStateChanged = function (state) {
if(state === 'fixed') stickyEl.nodeRef.classList.add('widget--sticky')
else stickyEl.nodeRef.classList.remove('widget--sticky')
}
</script>
</body>
</html>