-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscroll.html
118 lines (102 loc) · 6.72 KB
/
scroll.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
<!DOCTYPE html>
<html lang="en-gb" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Scroll - UIkit tests</title>
<script src="js/test.js"></script>
<script>
const {$$, attr, on} = UIkit.util;
on(document, 'change', '#offset', e =>
attr($$('[uk-scroll]'), 'data-offset', e.target.value)
)
</script>
</head>
<body>
<div class="uk-container">
<h1>Scroll</h1>
<div class="uk-margin">
<label class="uk-form-label" for="offset">Offset</label>
<div class="uk-form-controls">
<input class="uk-input uk-form-width-small" id="offset" type="text" value="0">
</div>
</div>
<a class="uk-button uk-button-default" href="#bottom" uk-scroll>Go Down!</a>
<a class="uk-button uk-button-default" href="#second-card" uk-scroll>Go to second card!</a>
<a class="uk-button uk-button-default" href="#nested-card" uk-scroll>Go to last nested card!</a>
<a id="js-top-callback" class="uk-button uk-button-default" href="#bottom" uk-scroll>Go Down with callback!</a>
<div class="uk-flex uk-flex-column uk-flex-center" style="height: 2000px;">
<div class="uk-overflow-auto" style="height: 300px;">
<div class="uk-card uk-card-default uk-card-hover uk-card-body">
<h3 class="uk-card-title">1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
</div>
<div id="second-card" class="uk-card uk-card-primary uk-card-hover uk-card-body">
<h3 class="uk-card-title">2</h3>
<div class="uk-overflow-auto" style="height: 250px;">
<div class="uk-card uk-card-default uk-card-hover uk-card-body">
<h3 class="uk-card-title">Nested 1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
</div>
<div class="uk-card uk-card-secondary uk-card-hover uk-card-body">
<h3 class="uk-card-title">Nested 2</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
</div>
<div id="nested-card" class="uk-card uk-card-default uk-card-hover uk-card-body">
<h3 class="uk-card-title">Nested 3</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
</div>
</div>
</div>
<div class="uk-card uk-card-secondary uk-card-hover uk-card-body">
<h3 class="uk-card-title">3</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
</div>
</div>
</div>
<a id="bottom" class="uk-button uk-button-default" href uk-scroll>Go Up!</a>
<a class="uk-button uk-button-default" href="#nested-card" uk-scroll>Go to last nested card!</a>
<script>
UIkit.util.on('#js-top-callback', 'scrolled', () =>
alert('Done.')
);
</script>
<h2>JavaScript Options</h2>
<div class="uk-overflow-auto">
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th>Option</th>
<th>Value</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>offset</code></td>
<td>Number</td>
<td>0</td>
<td>Offset added to scroll top.</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>