-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
358 lines (315 loc) · 19.2 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!doctype html>
<html>
<head>
<title>ABigImage | js | tools | aeqdev.com</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="ABigImage is jQuery plugin for viewing big versions of images.">
<link rel="stylesheet" href="http://aeqdev.com/tools/css/default/adefault-light.min.css">
<style>
body {
font-family: Arial, sans-serif;
/*margin: 0;*/
/*padding: 0;*/
/*overflow: hidden;*/
}
/*.container {*/
/*position: fixed;*/
/*left: 0;*/
/*right: 0;*/
/*top: 0;*/
/*bottom: 0;*/
/*overflow: auto;*/
/*}*/
.wrapper {
max-width: 200mm;
margin: 0 auto;
}
@media (min-width: 700px) {
.coll {
float: left;
width: 50%;
}
.colr {
float: right;
width: 300px;
}
}
.clearfix {
clear: both;
}
.example {
overflow: hidden;
clear: both;
}
.example a {
display: block;
float: left;
margin: 0 .5em .5em 0;
}
.example img {
display: block;
}
.example span {
display: none;
}
/* Highlight.js */
/* Darkula color scheme from the JetBrains family of IDEs */
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #2b2b2b;
}
.hljs {
color: #bababa;
}
.hljs-strong,
.hljs-emphasis {
color: #a8a8a2;
}
.hljs-bullet,
.hljs-quote,
.hljs-link,
.hljs-number,
.hljs-regexp,
.hljs-literal {
color: #6896ba;
}
.hljs-code,
.hljs-selector-class {
color: #a6e22e;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-section,
.hljs-attribute,
.hljs-name,
.hljs-variable {
color: #cb7832;
}
.hljs-params {
color: #b9b9b9;
}
.hljs-string,
.hljs-subst,
.hljs-type,
.hljs-built_in,
.hljs-builtin-name,
.hljs-symbol,
.hljs-selector-id,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-template-tag,
.hljs-template-variable,
.hljs-addition {
color: #e0c46c;
}
.hljs-comment,
.hljs-deletion,
.hljs-meta {
color: #7f7f7f;
}
</style>
</head>
<body>
<div class="container">
<div class="wrapper">
<h1 id="abigimage">ABigImage</h1>
<p><code>ABigImage</code> is jQuery plugin for viewing big versions of images.</p>
<p>Current version <strong>2.1.1</strong> (2018-01-20).</p>
<div class="colr">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="NUZ7CTKFYDX8C">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="Donate PayPal">
<img alt="" border="0" src="https://www.paypalobjects.com/ru_RU/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
<ul>
<li><a href="abigimage.jquery.js">abigimage.jquery.js</a> (30.1 kB) <a href="abigimage.jquery.min.js">min</a> (10.2 kB, gzipped 3.6 kB)</li>
<li><a href="abigimage.jquery.css">abigimage.jquery.css</a> (6 kB) <a href="abigimage.jquery.min.css">min</a> (3.1 kB, gzipped 801 bytes)</li>
<li>Fork at <a href="https://github.com/makryl/ABigImage">Github</a></li>
</ul>
<h2 id="features">Features</h2>
<ul>
<li>Fit mobile devices.</li>
<li>Uses CSS3 transform and transition for smooth touch sliding.</li>
<li>Touch slide left or right opens next or previous image, touch slide up or down closes image.</li>
<li>Multi-touch and double-tap zoom, zoom out closes image.</li>
<li>Clicking image opens next one, clicking left side opens previous, clicking right side closes image.</li>
<li>Hotkeys for next, previous and close buttons.</li>
<li>Closing after viewing of all images.</li>
<li>Preloading of next and previous images.</li>
<li>Images counter.</li>
<li>Uses link's <code>href</code> or <code>data-href</code> attribute for large images.</li>
<li>Fully customizable styles.</li>
<li>Customizable, scrolling down bottom area.</li>
<li>Customizable <code>onopen</code> and <code>onclose</code> event.</li>
</ul>
<h2 class="clearfix">Example</h2>
<p class="example">
<a href="img/1-big.jpg"><img src="img/1-small.jpg" alt="First image"></a>
<a href="img/2-big.jpg">
<img src="img/2-small.jpg" alt="Second image. Scroll down me, please!">
<span><br>Under bottom area here.</span>
</a>
<a href="img/3-big.jpg"><img src="img/3-small.jpg" alt="Third image"></a>
<a href="img/4-big.jpg"><img src="img/4-small.jpg" alt="Fourth image"></a>
</p>
<p>Live example, where I'm using and testing this plugin at the moment: <a href="http://kawaiinyan.com/" target="_blank">kawaiinyan.com</a>.</p>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="abigimage.jquery.js"></script>
<link rel="stylesheet" href="abigimage.jquery.min.css">
<script>
$('a[href$=".jpg"]').abigimage({
onopen: function(target) {
this.bottom.html(
/* bottom caption */
$('img', target).attr('alt') +
/* under bottom area */
($('span', target).html() || '')
);
}
});
</script>
<h2 id="usage">Usage</h2>
<h3 id="basic">Basic</h3>
<p>Add jQuery and ABigImage scripts, and ABigImage styles at your page.</p>
<pre><code class="hljs lang-html"><span class="hljs-tag"><<span class="hljs-title">script</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">"jquery.js"</span>></span><span class="javascript"></span><span class="hljs-tag"></<span class="hljs-title">script</span>></span>
<span class="hljs-tag"><<span class="hljs-title">script</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">"abigimage.jquery.js"</span>></span><span class="javascript"></span><span class="hljs-tag"></<span class="hljs-title">script</span>></span>
<span class="hljs-tag"><<span class="hljs-title">link</span> <span class="hljs-attribute">rel</span>=<span class="hljs-value">"stylesheet"</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">"abigimage.jquery.css"</span>></span>
</code></pre>
<p>Call plugin on selector of enlargeable images links.</p>
<pre><code class="hljs lang-js">$(<span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">()</span></span>{
<span class="hljs-comment">/* all links with class "myimgclass" */</span>
$(<span class="hljs-string">'.myimgclass'</span>).abigimage();
<span class="hljs-comment">/* or all links inside element with class "myimgboxclass" */</span>
$(<span class="hljs-string">'.myimgboxclass a'</span>).abigimage();
<span class="hljs-comment">/* or all links to "*.jpg" images */</span>
$(<span class="hljs-string">'a[href$=".jpg"]'</span>).abigimage();
<span class="hljs-comment">/* or all links to images under dir "/my/images/dir/" */</span>
$(<span class="hljs-string">'a[href^="/my/images/dir/"]'</span>).abigimage();
});
</code></pre>
<h3 id="options">Options</h3>
<ul>
<li><code>duration</code> - effects duration (default: <code>200</code>).</li>
<li><code>slideWidth</code> - slide width to switch or close image (between 0 and 1, default: 0.4).</li>
<li><code>slideVelocity</code> - slide velocity to switch or close image (pixels per millisecond, default: 0.4).</li>
<li><code>zoomMin</code> - minimal zoom that will hold (default: 1.5).</li>
<li><code>zoomMax</code> - maximal zoom (default: 5).</li>
<li><code>zoomClose</code> - zoom that will close image (default: 0.9).</li>
<li><code>zoomMoveViewport</code> - area for mouse moving when zoomed (default: 0.9).</li>
<li><code>zoomVelocity</code> - zoom velocity on scroll or press button (pixels per millisecond, default: .04).</li>
<li><code>doubleTapInterval</code> - zoom double-tap interval (milliseconds, default: 400).</li>
<li><code>prevBtnHtml</code> - html of "previous" button (default: <code>&larr;</code>).</li>
<li><code>nextBtnHtml</code> - html of "next" button (default: <code>&rarr;</code>).</li>
<li><code>zoomInBtnHtml</code> - html of "zoom in" button (default: <code>&plus;</code>).</li>
<li><code>zoomOutBtnHtml</code> - html of "zoom out" button (default: <code>&minus;</code>).</li>
<li><code>closeBtnHtml</code> - html of "close" button (default: <code>&times;</code>).</li>
<li><code>keyNext</code> - hotkeys for "next" button (default: 13 enter, 32 space, 39 right, 40 down).</li>
<li><code>keyPrev</code> - hotkeys for "previous" button (default: 8 backspace, 37 left, 38 up).</li>
<li><code>keyClose</code> - hotkeys for "close" button (default: 27 escape, 35 end, 36 home).</li>
<li><code>onopen</code> - function called when image opens.</li>
<li><code>onclose</code> - function called when image closes.</li>
</ul>
<p>To change styles use CSS classes of plugin's elements:</p>
<pre><code class="hljs lang-html"><span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-overlay"</span>></span><span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-layout"</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-wrapper"</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-box"</span>></span>
<span class="hljs-comment"><!-- prevBtnBox - clickable behind the image, width 50% --></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-prevBtnBox"</span>></span><span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-comment"><!-- closeBtnBox - clickable behind the image, width 50% --></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-closeBtnBox"</span>></span><span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"><<span class="hljs-title">img</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-img"</span>></span>
<span class="hljs-tag"><<span class="hljs-title">img</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-imgNext"</span>></span>
<span class="hljs-tag"><<span class="hljs-title">img</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-imgPrev"</span>></span>
<span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-top"</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-prevBtn"</span>></span><span class="hljs-comment"><!-- prevBtnHtml --></span><span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-nextBtn"</span>></span><span class="hljs-comment"><!-- nextBtnHtml --></span><span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-counter"</span>></span><span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-closeBtn"</span>></span><span class="hljs-comment"><!-- closeBtnHtml --></span><span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-zoomOutBtn"</span>></span><span class="hljs-comment"><!-- zoomOutBtnHtml --></span><span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-zoomInBtn"</span>></span><span class="hljs-comment"><!-- zoomInBtnHtml --></span><span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-bottomBox"</span>></span>
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"abigimage-bottom"</span>></span><span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"></<span class="hljs-title">div</span>></span>
<span class="hljs-tag"></<span class="hljs-title">div</span>></span>
</code></pre>
<h3 id="using-onopen-handler">Using onopen handler</h3>
<p>Function, defined as <code>onopen</code> handler, executes in context of plugin, and receives target element as argument. Plugin elements available in this context as properties.</p>
<pre><code class="hljs lang-js">$(<span class="hljs-string">'a[href$=".jpg"]'</span>).abigimage({
onopen: <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">(target)</span> </span>{
<span class="hljs-keyword">this</span>.bottom.html(
<span class="hljs-comment">/* bottom caption */</span>
$(<span class="hljs-string">'img'</span>, target).attr(<span class="hljs-string">'alt'</span>) +
<span class="hljs-comment">/* custom bottom area */</span>
($(<span class="hljs-string">'span'</span>, target).html() || <span class="hljs-string">''</span>)
);
}
});
</code></pre>
<h3 id="using-custom-links-with-data-href-attribute">Using custom links with data-href attribute</h3>
<p>If you want different link for plugin's big image and for non-javascript clients (search engines or browsers without javascript) - use <code>data-href</code> attribute:</p>
<pre><code class="hljs lang-html"><span class="hljs-tag"><<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">"/non_javascript_link.html"</span> <span class="hljs-attribute">data-href</span>=<span class="hljs-value">"/images/big/myimage.jpg"</span>></span> ... <span class="hljs-tag"></<span class="hljs-title">a</span>></span>
</code></pre>
<p>Also, you can use <code>data-href</code> attribute on any element, not only links.</p>
<h3 id="static-methods">Static methods</h3>
<ul>
<li><code>open([src], [index], [sel])</code> - open image by URL or index.</li>
<li><code>next([sel])</code> - open next image.</li>
<li><code>prev([sel])</code> - open previous image.</li>
<li><code>close([sel])</code> - close image.</li>
<li><code>unbind([sel])</code> - unbind plugin events.</li>
</ul>
<pre><code class="hljs lang-js"><span class="hljs-comment">/* open image by URL */</span>
$.abigimage.open(<span class="hljs-string">'/awesomeimage.jpg'</span>);
<span class="hljs-comment">/* open image by index */</span>
$.abigimage.open(<span class="hljs-number">2</span>);
<span class="hljs-comment">/* open image by URL at specified position */</span>
$.abigimage.open(<span class="hljs-string">'/awesomeimage.jpg'</span>, <span class="hljs-number">5</span>);
<span class="hljs-comment">/* open next image */</span>
$.abigimage.next();
<span class="hljs-comment">/* open previous image */</span>
$.abigimage.prev();
<span class="hljs-comment">/* close image */</span>
$.abigimage.close();
<span class="hljs-comment">/* unbind plugin events */</span>
$.abigimage.unbind();
</code></pre>
<p>All static methods by default tries to execute on current opened plugin insatnce, if no instances opened, tries to execute on last created instance. You can specify instance by passing it's selector in last argument <code>sel</code>.</p>
<pre><code class="hljs lang-js">$myimgs1 = $(<span class="hljs-string">'.myimgs1 a'</span>).abigimage();
$myimgs2 = $(<span class="hljs-string">'.myimgs2 a'</span>).abigimage();
$.abigimage.open(<span class="hljs-string">'/awesomeimage.jpg'</span>, <span class="hljs-literal">null</span>, $myimgs2);
$.abigimage.unbind($myimgs1);
</code></pre>
<h2 id="changes">Changes</h2>
<ul>
<li><strong>2.1.1</strong> - fixed init in <code>head</code>, plugin now has lazy creation of it's dom.</li>
<li><strong>2.1.0</strong> - improved animations for not fully loaded images, improved zoom positioning, added mouse scroll zoom, added scrolling down bottom area, added zoom out closing, added next and zoom buttons, added loading spinner, added images counter, fixed prevention of non-plugin's hotkeys.</li>
<li><strong>2.0.0</strong> - fixed multiple plugin instances context, added double-tap zoom, optimized touch event handlers, styles moved to CSS file, license changed to MIT.</li>
<li><strong>1.3.1</strong> - fixed image caching, added <code>unbind</code> method.</li>
</ul>
<h2 id="mit-license">MIT License</h2>
<p>Copyright (c) 2014-2018 Maksim Krylosov <a href="mailto:aequiternus@gmail.com">aequiternus@gmail.com</a></p>
</div>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-11259339-5', 'aeqdev.com');
ga('send', 'pageview');
</script>
</body>
</html>