-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.html
121 lines (107 loc) · 3.49 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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>Slider to quickly compare two images</title>
<link rel="stylesheet" href="src/ImageComparison.css">
<script src="src/ImageComparison.js"></script>
<style>
* {
padding: 0;
margin: 0;
}
body {
background: #EFEFEF;
}
.wrapper {
max-width: 768px;
margin: 20px auto;
text-align: center;
}
.header {
padding: 10px;
text-align: center;
background: black;
color: #FFF;
font-size: 0;
box-shadow: 0px 2px 10px #736F6E;
}
.header h1 {
display: inline-block;
padding-top: 1px;
font-family: Verdana, sans-serif;
font-size: 14px;
text-transform: uppercase;
}
.header h1 a {
color: #FFF;
text-decoration: none;
}
.iframe-wrapper {
display: inline-block;
margin-left: 15px;
vertical-align: top;
}
@media only screen and (max-width: 960px) {
.fork-me,
.iframe-wrapper {
display: none;
}
}
</style>
<script>
document.addEventListener('DOMContentLoaded', domReady);
function domReady() {
var imageComparisonCollection = document.querySelectorAll('.js-comparison-container');
for (var i = 0; i < imageComparisonCollection.length; i++) {
var imageWidget = imageComparisonCollection[i];
var images = imageWidget.querySelectorAll('.comparison-image');
new returnExports.ImageComparison({
container: imageWidget,
startPosition: imageWidget.getAttribute('start-position'),
data: [
{
image: images[0],
label: 'before'
},
{
image: images[1],
label: 'after'
}
],
});
}
}
</script>
</head>
<body>
<a class="fork-me" href="https://github.com/M-Ulyanov/ImageComparison/"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/52760788cde945287fbb584134c4cbc2bc36f904/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"></a>
<div class="header">
<h1>
<a href="https://github.com/M-Ulyanov/ImageComparison/">Image comparison native JS</a>
</h1>
<div class="iframe-wrapper">
<iframe src="https://ghbtns.com/github-btn.html?user=M-Ulyanov&repo=ImageComparison&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px"></iframe>
</div>
</div>
<div class="wrapper">
<div class="js-comparison-container">
<img class="comparison-image" src="src/images/1-before.jpg" alt="">
<img class="comparison-image" src="src/images/1-after.jpg" alt="">
</div>
</div>
<div class="wrapper">
<div class="js-comparison-container">
<img class="comparison-image" src="src/images/2-before.jpg" alt="">
<img class="comparison-image" src="src/images/2-after.jpg" alt="">
</div>
</div>
<div class="wrapper">
<div class="js-comparison-container" data-start-position="90">
<img class="comparison-image" src="src/images/3-before.jpg" alt="">
<img class="comparison-image" src="src/images/3-after.jpg" alt="">
</div>
</div>
</body>
</html>