forked from kingdido999/zooming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
220 lines (172 loc) Β· 6.43 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>
<html lang="en">
<head>
<!-- Basic Page Needs
ββββββββββββββββββββββββββββββββββββββββββββββββββ -->
<meta charset="utf-8">
<title>Zooming</title>
<meta name="description" content="Image zoom that makes sense.">
<meta name="keywords" content="Image,Zoom,Image Zoom,JavaScript">
<meta name="author" content="Pengcheng Ding">
<!-- Mobile Specific Metas
ββββββββββββββββββββββββββββββββββββββββββββββββββ -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- FONT
ββββββββββββββββββββββββββββββββββββββββββββββββββ -->
<link href="https://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<!-- CSS
ββββββββββββββββββββββββββββββββββββββββββββββββββ -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
<style>
.container {
max-width: 600px;
}
section.header {
margin-top: 4rem;
text-align: center;
}
section.content {
text-align: center;
}
footer {
text-align: center;
}
.value-img {
display: block;
text-align: center;
margin: 2em 0;
}
img {
max-width: 100%;
}
@media (min-width: 550px) {
.header {
margin-top: 10rem;
}
}
.button.button-primary {
background-color: #f9c04d !important;
border-color: #f9c04d !important;
}
.button.button-secondary {
background-color: #eee !important;
border-color: #eee !important;
}
</style>
</head>
<body>
<!-- Primary Page Layout
ββββββββββββββββββββββββββββββββββββββββββββββββββ -->
<div class="container">
<section class="header">
<h2>Zooming</h2>
<div class="value-img">
<img id="img-default" src="assets/img/journey_start_thumbnail.jpg" data-action="zoom" data-original="assets/img/journey_start.jpg"
alt="journey_start_thumbnail" />
</div>
</section>
<section class="content">
<h4>Image zoom that makes sense.</h4>
<ul>
<li>Pure JavaScript & built with mobile in mind.</li>
<li>Smooth animations with intuitive gestures.</li>
<li>Zoom into a hi-res image if supplied.</li>
<li>Easy to integrate & customizable.</li>
</ul>
<div class="value-img">
<a href="assets/img/journey.jpg">
<img id="img-custom" src="assets/img/journey_thumbnail.jpg" alt="journey_thumbnail" />
</a>
</div>
<p>
<small>Options below were designed to affect the second image only.</small>
</p>
<div class="row">
<a class="button" id="btn-fast">faster</a>
<a class="button" id="btn-dark">dark</a>
<a class="button" id="btn-scale-small">smaller</a>
</div>
<br>
<p>
<em>Faced with rolling sand dunes, age-old ruins, caves and howling winds, your passage will not be an easy one. The
goal is to get to the mountaintop, but the experience is discovering who you are, what this place is, and what
is your purpose.</em>
</p>
<br>
<a class="button" href="https://github.com/kingdido999/zooming">GitHub</a>
<a class="button button-primary" href="http://kingdido999.github.io/zooming/docs">Get Started</a>
</section>
<br>
</div>
<hr>
<footer>
<p id="copyright"></p>
<p id="license">
<a href="https://opensource.org/licenses/MIT">The MIT License</a>
</p>
</footer>
<!-- Scripts
ββββββββββββββββββββββββββββββββββββββββββββββββββ -->
<script src="build/zooming.js"></script>
<script>
const defaultZooming = new Zooming()
const customZooming = new Zooming()
const config = customZooming.config()
const TRANSITION_DURATION_DEFAULT = config.transitionDuration
const BG_COLOR_DEFAULT = config.bgColor
const SCALE_BASE_DEFAULT = config.scaleBase
const ACTIVE_CLASS = 'button-primary'
const btnFast = document.getElementById('btn-fast')
const btnDark = document.getElementById('btn-dark')
const btnScaleSmall = document.getElementById('btn-scale-small')
document.addEventListener('DOMContentLoaded', function () {
defaultZooming.listen('#img-default')
customZooming.listen('#img-custom')
})
btnFast.addEventListener('click', function (event) {
const transitionDuration = toggleActive(btnFast)
? 0.2
: TRANSITION_DURATION_DEFAULT
customZooming.config({ transitionDuration })
})
btnDark.addEventListener('click', function (event) {
const bgColor = toggleActive(btnDark)
? 'black'
: BG_COLOR_DEFAULT
customZooming.config({ bgColor })
})
btnScaleSmall.addEventListener('click', function (event) {
const scaleBase = toggleActive(btnScaleSmall)
? 0.7
: SCALE_BASE_DEFAULT
customZooming.config({ scaleBase })
})
function isActive(el) {
return el.classList.contains(ACTIVE_CLASS)
}
function activate(el) {
el.classList.add(ACTIVE_CLASS)
}
function deactivate(el) {
el.classList.remove(ACTIVE_CLASS)
}
function toggleActive(el) {
if (isActive(el)) {
deactivate(el)
return false
} else {
activate(el)
return true
}
}
const copyright = 'Copyright Β© ' +
new Date().getFullYear() +
' <a href="https://github.com/kingdido999">Pengcheng Ding</a>' +
' and other <a href="https://github.com/kingdido999/zooming/graphs/contributors">contributors</a>'
document.getElementById('copyright').innerHTML = copyright
</script>
<!-- End Document
ββββββββββββββββββββββββββββββββββββββββββββββββββ -->
</body>
</html>