forked from Serrin/imgLightbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimglightbox.html
211 lines (171 loc) · 8.57 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
<!DOCTYPE html>
<!-- version 1.0.4 -->
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="Author" content="Czigler Ferenc, Miyako Jones" />
<title>imgLightbox</title>
<link href="imglightbox.css" rel="stylesheet" type="text/css" />
<link href="fontawesome/fontawesome.min.css" rel="stylesheet" type="text/css" />
<link href="fontawesome/solid.min.css" rel="stylesheet" type="text/css" />
<style>
*,:before,:after { box-sizing: border-box; word-break: break-all; word-wrap: break-word;}
body {
font-family: Arial, Helvetica, sans-serif;
text-align: justify;
margin: 0 auto;
padding: 5px;
font-size: 15px;
max-width: 900px;
width: 100%;
}
header, footer, h1, h2, .center { text-align: center; }
pre, code {
background-color: lightgrey;
text-align: left;
padding: 5px;
white-space: pre-wrap;
word-wrap: break-word;
}
code, button { display: inline-block; margin: 2px; }
.thumbnail { width: 300px; height: auto; }
</style>
</head>
<body>
<header>
<h1>imgLightbox</h1>
<p>Just another simple image lightbox.</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 externally and close" id="imgLightbox-button-external">
<span class="imgLightbox-button"><i class="fas fa-expand-alt"></i></span>
</a>
<a title="download and close" id="imgLightbox-button-download">
<span class="imgLightbox-button"><i class="fas fa-arrow-alt-circle-down"></i></span>
</a>
<span title="close" class="imgLightbox-button" onclick="imgLightbox.close();"><i class="fas fa-times-circle"></i></span>
</div>
<div id="imgLightbox-image-area"></div>
</div></pre>
<p>Insert the references to FontAwesome for the lightbox icons:</p>
<pre><link href="fontawesome/fontawesome.min.css" rel="stylesheet" type="text/css" />
<link href="fontawesome/solid.min.css" rel="stylesheet" type="text/css" /></pre>
<p>If you don't want to use FontAwesome, use this HTML instead and don't insert the references to FontAwesome:</p>
<pre><div id="imgLightbox" onclick="imgLightbox.close();">
<div id="imgLightbox-button-area">
<a title="open externally and close" id="imgLightbox-button-external">
<span class="imgLightbox-button">&nearr;</i></span>
</a>
<a title="download and close" id="imgLightbox-button-download">
<span class="imgLightbox-button">&DownArrowBar;</i></span>
</a>
<span title="close" class="imgLightbox-button" onclick="imgLightbox.close();">&Cross;</i></span>
</div>
<div id="imgLightbox-image-area"></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.externalOpen (default is false):</h3>
<p>
<button onclick="imgLightbox.config.externalOpen=true;">set true</button>
<code>imgLightbox.config.externalOpen = true;</code>
<br/>
<button onclick="imgLightbox.config.externalOpen=false;">set false</button>
<code>imgLightbox.config.externalOpen = false;</code>
</p>
<h3>imgLightbox.open() method parameters:</h3>
<p><code>imgLightbox.open(<filename: string>, <config: object>);</code></p>
<hr/>
<h2>Samples</h2>
<h3>Open with the download button</h3>
<p><code>imgLightbox.open('test1.jpg', {download: true});</code></p>
<p class="center"><img id="test1-400" src="test1-400.jpg" class="thumbnail" onclick="imgLightbox.open('test1.jpg', {download: true});"></p>
<h3>Open with the download button and the external open button</h3>
<p><code>imgLightbox.open('test1.jpg', {download: true, externalOpen: true});</code></p>
<p class="center"><img id="test1-400" src="test1-400.jpg" class="thumbnail" onclick="imgLightbox.open('test1.jpg', {download: true, externalOpen: true});"></p>
<h3>Open with the config.download setting:</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>
<h3>Open with the external open button but no download button:</h3>
<p><code>imgLightbox.open('test1.jpg', {externalOpen: true});</code></p>
<p class="center"><img src="test1-400.jpg" class="thumbnail" onclick="imgLightbox.open('test1.jpg', {externalOpen: true});"></p>
<hr/>
<h3>Small size image with the download button:</h3>
<p><code>imgLightbox.open('test2.jpg', {download: true});</code></p>
<p class="center"><img src="test2.jpg" onclick="imgLightbox.open('test2.jpg', {download: true});"></p>
<h3>Small size image with the external open button:</h3>
<p><code>imgLightbox.open('test2.jpg', {externalOpen: true});</code></p>
<p class="center"><img src="test2.jpg" onclick="imgLightbox.open('test2.jpg', {externalOpen: true});"></p>
<h3>Small size image with the config.download setting:</h3>
<p><code>imgLightbox.open('test2.jpg');</code></p>
<p class="center"><img src="test2.jpg" onclick="imgLightbox.open('test2.jpg');"></p>
<h3>Small size image without the download button:</h3>
<p><code>imgLightbox.open('test2.jpg', {download: false});</code></p>
<p class="center"><img src="test2.jpg" onclick="imgLightbox.open('test2.jpg', {download: false});"></p>
<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/miyakoj" target="_blank">Github</a></p>
<p>© Ferenc Czigler 2017; Miyako Jones 2020</p>
</small>
</footer>
<!-- Insert this code into the page: -->
<div id="imgLightbox" onclick="imgLightbox.close();">
<div id="imgLightbox-button-area">
<a title="open externally and close" id="imgLightbox-button-external">
<span class="imgLightbox-button"><i class="fas fa-expand-alt"></i></span>
</a>
<a title="download and close" id="imgLightbox-button-download">
<span class="imgLightbox-button"><i class="fas fa-arrow-alt-circle-down"></i></span>
</a>
<span title="close" class="imgLightbox-button" onclick="imgLightbox.close();"><i class="fas fa-times-circle"></i></span>
</div>
<div id="imgLightbox-image-area"></div>
</div>
<script src="imglightbox.js"></script>
</body>
</html>