forked from yyx990803/zoomerang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
108 lines (103 loc) · 3.52 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Zoomerang.js</title>
<meta charset="utf-8">
<link href='http://fonts.googleapis.com/css?family=Montserrat:700,400' rel='stylesheet' type='text/css'>
<style type="text/css">
body {
font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-srif;
padding: 0 30px;
width: 80%;
margin: 0 auto;
font-size: 24px;
color: #fff;
background-color: #f66;
position: relative;
}
a {
color: #fff;
text-decoration: none;
}
a:hover {
border-bottom: 4px solid #fff;
}
.zoom {
cursor: pointer;
}
img.zoom {
border-radius: 100%;
}
.gh {
font-size: 24px;
float: right;
margin-top: 24px;
}
.avatar {
vertical-align: top;
width: 36px;
height: 36px;
margin-right: 6px;
}
#footer {
text-align: center;
margin: 40px 0;
line-height: 36px;
}
</style>
</head>
<body>
<h1><span class="zoom">Zoomerang.js</span> <a class="gh" href="https://github.com/yyx990803/zoomerang">GitHub</a></h1>
<div>is a drop-in library that allows your users to zoom in on (almost) any element on your existing page. No setup, arbitrary styling.</div>
<p><img src="test.jpg" class="zoom"> <- click me</p>
<p><span class="zoom">And</span></p>
<p><span class="zoom">it</span></p>
<p><span class="zoom">works</span></p>
<p><span class="zoom">even</span></p>
<p><span class="zoom">if</span></p>
<p><span class="zoom">you</span></p>
<p><span class="zoom">resize</span></p>
<p><span class="zoom">or</span></p>
<p><span class="zoom">scroll</span></p>
<p><span class="zoom">your</span></p>
<p><span class="zoom">page.</span></p>
<p><img src="test.jpg" class="zoom"></p>
<div id="footer">
<img class="avatar zoom" src="https://1.gravatar.com/avatar/eca93da2c67aadafe35d477aa8f454b8?s=440"> By <a href="http://evanyou.me" taget="_blank">Evan You</a>
</div>
<script src="zoomerang.js"></script>
<script>
Array.prototype.forEach.call(document.querySelectorAll('p'), function (p, i) {
p.style.marginLeft = i * 6 + '%'
})
Zoomerang
.config({
maxHeight: 400,
maxWidth: 400,
bgColor: '#000',
bgOpacity: .85,
onOpen: openCallback,
onClose: closeCallback,
onBeforeOpen: beforeOpenCallback,
onBeforeClose: beforeCloseCallback
})
.listen('.zoom')
function openCallback (el) {
console.log('zoomed in on: ')
console.log(el)
}
function closeCallback (el) {
console.log('zoomed out on: ')
console.log(el)
}
function beforeOpenCallback (el) {
console.log('on before zoomed in on:')
console.log(el)
}
function beforeCloseCallback (el) {
console.log('on before zoomed out on:')
console.log(el)
}
</script>
</body>
</html>