-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimglightbox.html
212 lines (182 loc) · 8.22 KB
/
imglightbox.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
<!DOCTYPE html>
<!-- version 1.0.5 -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<title>imgLightbox</title>
<meta name="Author" content="Czigler Ferenc">
<link href="u87.min.css" rel="stylesheet" type="text/css">
<link href="imglightbox.css" rel="stylesheet" type="text/css">
<script src="imglightbox.js"></script>
<style>
header, footer, h1, h2, .center { text-align: center; }
.thumbnail { width: 300px; height: auto; }
</style>
</head>
<body class="container">
<header>
<h1>imgLightbox</h1>
<p>Just another simple image lightbox without dependecies.</p>
<p>IE11, mobile browser and ES5 compatible.</p>
</header>
<hr/>
<h2>API</h2>
<h3>Include</h3>
<p>Insert the .js and .css file in the page header:</p>
<pre><link href="imglightbox.min.css" rel="stylesheet" type="text/css">
<script src="imglightbox.min.js"></script></pre>
<p>Insert this code in your html page:</p>
<pre><div id="imgLightbox" onclick="imgLightbox.close();">
<div id="imgLightbox-button-area">
<a title="open in new window and close" id="imgLightbox-button-newwindow">
<span class="imgLightbox-button">&UpperRightArrow;</span>
</a>
<a title="download and close" id="imgLightbox-button-download">
<span class="imgLightbox-button">&DownArrowBar;</span>
</a>
<span title="close" class="imgLightbox-button" onclick="imgLightbox.close();">&Cross;</span>
</div>
</div></pre>
<h3>Get the library version:</h3>
<p>
<button onclick="alert( imgLightbox.config.version );">alert</button>
<code>alert( imgLightbox.config.version );</code>
</p>
<h3>Set config.download (default is false):</h3>
<p>
<button onclick="imgLightbox.config.download=true;">set true</button>
<code>imgLightbox.config.download = true;</code>
<br/>
<button onclick="imgLightbox.config.download=false;">set false</button>
<code>imgLightbox.config.download = false;</code>
</p>
<h3>Set config.newwindow (default is false):</h3>
<p>
<button onclick="imgLightbox.config.newwindow=true;">set true</button>
<code>imgLightbox.config.newwindow = true;</code>
<br/>
<button onclick="imgLightbox.config.newwindow=false;">set false</button>
<code>imgLightbox.config.newwindow = false;</code>
</p>
<h3>imgLightbox.open() method parameters:</h3>
<p><code>imgLightbox.open(<filename: string>[,download: boolean[,newwindow: boolean]]);</code></p>
<hr/>
<h2>Samples</h2>
<div class="flex">
<div class="flex-f-1">
<h3>Open with the download button:</h3>
<p><code>imgLightbox.open('test1.jpg',true);</code></p>
<p class="center"><img src="test1-400.jpg" class="thumbnail" onclick="imgLightbox.open('test1.jpg',true);"></p>
</div>
<div class="flex-f-1">
<h3>Small size image with the download button:</h3>
<p><code>imgLightbox.open('test2.jpg',true);</code></p>
<p class="center"><img src="test2.jpg" onclick="imgLightbox.open('test2.jpg',true);"></p>
</div>
</div>
<div class="flex">
<div class="flex-f-1">
<h3>Open without the download and with the newwindow buttons:</h3>
<p><code>imgLightbox.open('test1.jpg',false,true);</code></p>
<p class="center"><img src="test1-400.jpg" class="thumbnail" onclick="imgLightbox.open('test1.jpg',false,true);"></p>
</div>
<div class="flex-f-1">
<h3>Small size image without the download and with the newwindow buttons:</h3>
<p><code>imgLightbox.open('test2.jpg',false,true);</code></p>
<p class="center"><img src="test2.jpg" onclick="imgLightbox.open('test2.jpg',false,true);"></p>
</div>
</div>
<div class="flex">
<div class="flex-f-1">
<h3>Open with the download and newwindow buttons:</h3>
<p><code>imgLightbox.open('test1.jpg',true,true);</code></p>
<p class="center"><img src="test1-400.jpg" class="thumbnail" onclick="imgLightbox.open('test1.jpg',true,true);"></p>
</div>
<div class="flex-f-1">
<h3>Small size image with the download and newwindow buttons:</h3>
<p><code>imgLightbox.open('test2.jpg',true,true);</code></p>
<p class="center"><img src="test2.jpg" onclick="imgLightbox.open('test2.jpg',true,true);"></p>
</div>
</div>
<div class="flex">
<div class="flex-f-1">
<h3>Open with the config.download and config.newwindow settings:</h3>
<p><code>imgLightbox.open('test1.jpg');</code></p>
<p class="center"><img src="test1-400.jpg" class="thumbnail" onclick="imgLightbox.open('test1.jpg');"></p>
</div>
<div class="flex-f-1">
<h3>Small size image with the config.download and config.newwindow settings:</h3>
<p><code>imgLightbox.open('test2.jpg');</code></p>
<p class="center"><img src="test2.jpg" onclick="imgLightbox.open('test2.jpg');"></p>
</div>
</div>
<div class="flex">
<div class="flex-f-1">
<h3>Open without the download button:</h3>
<p><code>imgLightbox.open('test1.jpg',false);</code></p>
<p class="center"><img src="test1-400.jpg" class="thumbnail" onclick="imgLightbox.open('test1.jpg',false);"></p>
</div>
<div class="flex-f-1">
<h3>Small size image without the download button:</h3>
<p><code>imgLightbox.open('test2.jpg',false);</code></p>
<p class="center"><img src="test2.jpg" onclick="imgLightbox.open('test2.jpg',false);"></p>
</div>
</div>
<div class="flex">
<div class="flex-f-1">
<h3>Open without the download and newwindow buttons:</h3>
<p><code>imgLightbox.open('test1.jpg',false,false);</code></p>
<p class="center"><img src="test1-400.jpg" class="thumbnail" onclick="imgLightbox.open('test1.jpg',false,false);"></p>
</div>
<div class="flex-f-1">
<h3>Small size image without the download and newwindow buttons:</h3>
<p><code>imgLightbox.open('test2.jpg',false,false);</code></p>
<p class="center"><img src="test2.jpg" onclick="imgLightbox.open('test2.jpg',false,false);"></p>
</div>
</div>
<hr/>
<div>
<p><a href="https://opensource.org/licenses/MIT" target="_blank">https://opensource.org/licenses/MIT</a></p>
<h2>MIT License</h2>
<p>SPDX short identifier: MIT</p>
<p>Copyright (c) 2017 Ferenc Czigler</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.</p>
</div>
<hr/>
<footer>
<small>
<p>Free photos from <a href="https://unsplash.com/" target="_blank">https://unsplash.com/</a></p>
<p><a href="https://github.com/Serrin/imgLightbox" target="_blank">Github</a></p>
<p>© Ferenc Czigler 2017</p>
</small>
</footer>
<!-- Insert these code into the page: -->
<div id="imgLightbox" onclick="imgLightbox.close();">
<div id="imgLightbox-button-area">
<a title="open in new window and close" id="imgLightbox-button-newwindow">
<span class="imgLightbox-button">↗</span>
</a>
<a title="download and close" id="imgLightbox-button-download">
<span class="imgLightbox-button">⤓</span>
</a>
<span title="close" class="imgLightbox-button" onclick="imgLightbox.close();">⨯</span>
</div>
</div>
</body>
</html>