/
index.html
220 lines (194 loc) · 10.1 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
<!DOCTYPE html>
<!--[if lt IE 7]><html class="lt-ie9 lt-ie8 lt-ie7" lang="en"><![endif]-->
<!--[if IE 7]><html class="lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if IE 8]><html class="lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--><html lang="en"><!--<![endif]-->
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="Armin Pfäffle" />
<meta name="robots" content="index, follow" />
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all" />
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<link rel="stylesheet" href="lib/css/ap-scroll-top.css" type="text/css" media="all" />
<script src="lib/js/ap-scroll-top.js"></script>
<title>ap-scroll-top</title>
</head>
<body>
<header>
<div class="wrapper">
<h1>ap-scroll-top</h1>
<h2>jQuery plugin for embedding a "Scroll to Top" element to website, with position fixed</h2>
</div>
</header>
<div id="content">
<ul>
<li>
<p>
This is just a demo for <a href="https://github.com/armin-pfaeffle/ap-scroll-top/">ap-scroll-top</a>. In order to show »<em>Scroll to Top</em>« element, <a href="#bottom">scroll down</a> this page.
</p>
</li>
<li>
<div id="options">
<div class="row">
<label for="option-enabled">Enabled:</label>
<input type="checkbox" checked="checked" id="option-enabled" name="option-enabled" />
</div>
<div class="row">
<label for="option-visibility-trigger">Visibility Trigger:</label>
<select id="option-visibility-trigger" name="option-visibility-trigger">
<option value="0">0</option>
<option value="100" selected="selected">100px</option>
<option value="400">400px</option>
<option value="custom-function">Custom function</option>
</select>
</div>
<div class="row">
<label for="option-visibility-fade-speed">Visibility Fade Speed:</label>
<select id="option-visibility-fade-speed" name="option-visibility-fade-speed">
<option value="0">0</option>
<option value="150" selected="selected">150ms</option>
<option value="500">500ms</option>
<option value="1500">1500ms</option>
</select>
</div>
<div class="row">
<label for="option-scroll-speed">Scroll Speed:</label>
<select id="option-scroll-speed" name="option-scroll-speed">
<option value="0">0</option>
<option value="100">100ms</option>
<option value="250" selected="selected">250ms</option>
<option value="500">500ms</option>
<option value="1500">1500ms</option>
</select>
</div>
<div class="row">
<label for="option-position">Position:</label>
<select id="option-position" name="option-position">
<optgroup label="Top">
<option value="top left">Left</option>
<option value="top center">Center</option>
<option value="top right">Right</option>
</optgroup>
<optgroup label="Bottom">
<option value="bottom left">Left</option>
<option value="bottom center">Center</option>
<option value="bottom right" selected="selected">Right</option>
</optgroup>
</select>
</div>
</div>
</li>
<li>
<p>
Thanks to <a href="https://www.flickr.com/photos/buzz_rozwell/">Atmospherics</a> for the photos!
</p>
</li>
<li>
<p>
<a href="https://www.flickr.com/photos/buzz_rozwell/16650218443/" title="Field Reflection 2"><img src="https://farm9.staticflickr.com/8725/16650218443_bb442aacc7_c.jpg" width="800" height="513" alt="Field Reflection 2" /></a>
</p>
</li>
<li>
<p id="image-for-custom-function">
<a href="https://www.flickr.com/photos/buzz_rozwell/16695168487/" title="Harbour Mountains"><img src="https://farm9.staticflickr.com/8716/16695168487_6663782019_c.jpg" width="800" height="534" alt="Harbour Mountains" /></a>
</p>
</li>
<li>
<p>
<a href="https://www.flickr.com/photos/buzz_rozwell/16300207983/" title="Water/Snow/Ice"><img src="https://farm8.staticflickr.com/7651/16300207983_784b95055a_c.jpg" width="800" height="534" alt="Water/Snow/Ice" /></a>
</p>
</li>
<li>
<p>
<a href="https://www.flickr.com/photos/buzz_rozwell/17047144785/" title="Volcanic Ice"><img src="https://farm9.staticflickr.com/8700/17047144785_e2edf01a7c_c.jpg" width="800" height="534" alt="Volcanic Ice" /></a>
</p>
<div id="bottom"></div>
</li>
</ul>
</div>
<script type="text/javascript">
// Setup plugin with default settings
$(document).ready(function() {
$.apScrollTop({
'onInit': function(evt) {
console.log('apScrollTop: init');
}
});
// Add event listeners
$.apScrollTop().on('apstInit', function(evt) {
console.log('apScrollTop: init');
});
$.apScrollTop().on('apstToggle', function(evt, details) {
console.log('apScrollTop: toggle / is visible: ' + details.visible);
});
$.apScrollTop().on('apstCssClassesUpdated', function(evt) {
console.log('apScrollTop: cssClassesUpdated');
});
$.apScrollTop().on('apstPositionUpdated', function(evt) {
console.log('apScrollTop: positionUpdated');
});
$.apScrollTop().on('apstEnabled', function(evt) {
console.log('apScrollTop: enabled');
});
$.apScrollTop().on('apstDisabled', function(evt) {
console.log('apScrollTop: disabled');
});
$.apScrollTop().on('apstBeforeScrollTo', function(evt, details) {
console.log('apScrollTop: beforeScrollTo / position: ' + details.position + ', speed: ' + details.speed);
// You can return a single number here, which means that to this position
// browser window scolls to
/*
return 100;
*/
// .. or you can return an object, containing position and speed:
/*
return {
position: 100,
speed: 100
};
*/
// .. or do not return anything, so the default values are used to scroll
});
$.apScrollTop().on('apstScrolledTo', function(evt, details) {
console.log('apScrollTop: scrolledTo / position: ' + details.position);
});
$.apScrollTop().on('apstDestroy', function(evt, details) {
console.log('apScrollTop: destroy');
});
});
// Add change events for options
$('#option-enabled').on('change', function() {
var enabled = $(this).is(':checked');
$.apScrollTop('option', 'enabled', enabled);
});
$('#option-visibility-trigger').on('change', function() {
var value = $(this).val();
if (value == 'custom-function') {
$.apScrollTop('option', 'visibilityTrigger', function(currentYPos) {
var imagePosition = $('#image-for-custom-function').offset();
return (currentYPos > imagePosition.top);
});
}
else {
$.apScrollTop('option', 'visibilityTrigger', parseInt(value));
}
});
$('#option-visibility-fade-speed').on('change', function() {
var value = parseInt($(this).val());
$.apScrollTop('option', 'visibilityFadeSpeed', value);
});
$('#option-scroll-speed').on('change', function() {
var value = parseInt($(this).val());
$.apScrollTop('option', 'scrollSpeed', value);
});
$('#option-position').on('change', function() {
var value = $(this).val();
$.apScrollTop('option', 'position', value);
});
</script>
</body>
</html>