viewerjs 1.11.9 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +223 -51
- package/dist/viewer.common.js +500 -114
- package/dist/viewer.css +111 -2
- package/dist/viewer.esm.js +500 -114
- package/dist/viewer.js +500 -114
- package/dist/viewer.min.css +3 -3
- package/dist/viewer.min.js +3 -3
- package/package.json +8 -9
- package/src/css/viewer.css +107 -1
- package/src/css/viewer.scss +107 -1
- package/src/js/constants.js +5 -0
- package/src/js/defaults.js +46 -4
- package/src/js/events.js +29 -2
- package/src/js/handlers.js +197 -7
- package/src/js/methods.js +89 -62
- package/src/js/others.js +48 -3
- package/src/js/render.js +83 -15
- package/src/js/template.js +7 -0
- package/src/js/utilities.js +70 -14
- package/src/js/viewer.js +82 -11
- package/types/index.d.ts +91 -55
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
# Viewer.js
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/viewerjs) [](https://www.npmjs.com/package/viewerjs) [](https://unpkg.com/viewerjs/dist/viewer.common.js)
|
|
3
|
+
[](https://codecov.io/gh/fengyuanchen/viewerjs) [](https://www.npmjs.com/package/viewerjs) [](https://www.npmjs.com/package/viewerjs) [](https://unpkg.com/viewerjs/dist/viewer.common.js)
|
|
4
4
|
|
|
5
5
|
> JavaScript image viewer.
|
|
6
6
|
|
|
7
7
|
- [Website](https://fengyuanchen.github.io/viewerjs)
|
|
8
8
|
- [jquery-viewer](https://github.com/fengyuanchen/jquery-viewer) - A jQuery plugin wrapper for Viewer.js.
|
|
9
9
|
|
|
10
|
-
## Table of
|
|
10
|
+
## Table of Contents
|
|
11
11
|
|
|
12
12
|
- [Features](#features)
|
|
13
13
|
- [Main Files](#main-files)
|
|
14
|
-
- [Getting
|
|
15
|
-
- [Keyboard
|
|
14
|
+
- [Getting Started](#getting-started)
|
|
15
|
+
- [Keyboard Support](#keyboard-support)
|
|
16
16
|
- [Options](#options)
|
|
17
17
|
- [Methods](#methods)
|
|
18
|
+
- [Static Methods](#static-methods)
|
|
18
19
|
- [Events](#events)
|
|
19
|
-
- [
|
|
20
|
-
- [Browser support](#browser-support)
|
|
20
|
+
- [Browser Support](#browser-support)
|
|
21
21
|
- [Contributing](#contributing)
|
|
22
22
|
- [Versioning](#versioning)
|
|
23
23
|
- [License](#license)
|
|
24
24
|
|
|
25
25
|
## Features
|
|
26
26
|
|
|
27
|
-
- Supports
|
|
27
|
+
- Supports 57 [options](#options)
|
|
28
28
|
- Supports 23 [methods](#methods)
|
|
29
29
|
- Supports 17 [events](#events)
|
|
30
30
|
- Supports modal and inline modes
|
|
@@ -34,9 +34,10 @@
|
|
|
34
34
|
- Supports rotation
|
|
35
35
|
- Supports scale (flip)
|
|
36
36
|
- Supports keyboard
|
|
37
|
+
- Supports image magnification
|
|
37
38
|
- Cross-browser support
|
|
38
39
|
|
|
39
|
-
## Main
|
|
40
|
+
## Main Files
|
|
40
41
|
|
|
41
42
|
```text
|
|
42
43
|
dist/
|
|
@@ -48,7 +49,7 @@ dist/
|
|
|
48
49
|
└── viewer.esm.js (ES Module)
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
## Getting
|
|
52
|
+
## Getting Started
|
|
52
53
|
|
|
53
54
|
### Installation
|
|
54
55
|
|
|
@@ -56,14 +57,14 @@ dist/
|
|
|
56
57
|
npm install viewerjs
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
In browser:
|
|
60
|
+
In the browser:
|
|
60
61
|
|
|
61
62
|
```html
|
|
62
|
-
<link
|
|
63
|
+
<link href="/path/to/viewer.css" rel="stylesheet">
|
|
63
64
|
<script src="/path/to/viewer.js"></script>
|
|
64
65
|
```
|
|
65
66
|
|
|
66
|
-
The [cdnjs](https://github.com/cdnjs/cdnjs) provides CDN support for Viewer.js
|
|
67
|
+
The [cdnjs](https://github.com/cdnjs/cdnjs) project provides CDN support for Viewer.js CSS and JavaScript. You can find the links [here](https://cdnjs.com/libraries/viewerjs).
|
|
67
68
|
|
|
68
69
|
### Usage
|
|
69
70
|
|
|
@@ -75,11 +76,13 @@ new Viewer(element[, options])
|
|
|
75
76
|
|
|
76
77
|
- **element**
|
|
77
78
|
- Type: `HTMLElement`
|
|
78
|
-
- The target image or container of images
|
|
79
|
+
- The target image, or a container of images, to view.
|
|
79
80
|
|
|
80
81
|
- **options** (optional)
|
|
81
82
|
- Type: `Object`
|
|
82
|
-
- The options
|
|
83
|
+
- The configuration options. Check out the available [options](#options).
|
|
84
|
+
|
|
85
|
+
Alternatively, you may use `Viewer.create(element[, options])`.
|
|
83
86
|
|
|
84
87
|
#### Example
|
|
85
88
|
|
|
@@ -110,15 +113,15 @@ const viewer = new Viewer(document.getElementById('image'), {
|
|
|
110
113
|
viewer.zoomTo(1);
|
|
111
114
|
},
|
|
112
115
|
});
|
|
113
|
-
// Then
|
|
116
|
+
// Then show the image by clicking it, or call `viewer.show()`.
|
|
114
117
|
|
|
115
118
|
// View a list of images.
|
|
116
|
-
// Note:
|
|
119
|
+
// Note: all images within the container will be found by calling `element.querySelectorAll('img')`.
|
|
117
120
|
const gallery = new Viewer(document.getElementById('images'));
|
|
118
|
-
// Then
|
|
121
|
+
// Then show one image by clicking it, or call `gallery.show()`.
|
|
119
122
|
```
|
|
120
123
|
|
|
121
|
-
## Keyboard
|
|
124
|
+
## Keyboard Support
|
|
122
125
|
|
|
123
126
|
> Only available in modal mode.
|
|
124
127
|
|
|
@@ -138,7 +141,7 @@ const gallery = new Viewer(document.getElementById('images'));
|
|
|
138
141
|
## Options
|
|
139
142
|
|
|
140
143
|
You may set viewer options with `new Viewer(image, options)`.
|
|
141
|
-
If you want to change the global default options,
|
|
144
|
+
If you want to change the global default options, you may use `Viewer.setDefaults(options)`.
|
|
142
145
|
|
|
143
146
|
### backdrop
|
|
144
147
|
|
|
@@ -156,7 +159,7 @@ Show the button on the top-right of the viewer.
|
|
|
156
159
|
|
|
157
160
|
### navbar
|
|
158
161
|
|
|
159
|
-
- Type: `Boolean` or `Number`
|
|
162
|
+
- Type: `Boolean` or `Number` or `String` or `Object`
|
|
160
163
|
- Default: `true`
|
|
161
164
|
- Options:
|
|
162
165
|
- `0` or `false`: hide the navbar
|
|
@@ -164,9 +167,58 @@ Show the button on the top-right of the viewer.
|
|
|
164
167
|
- `2`: show the navbar only when the screen width is greater than 768 pixels
|
|
165
168
|
- `3`: show the navbar only when the screen width is greater than 992 pixels
|
|
166
169
|
- `4`: show the navbar only when the screen width is greater than 1200 pixels
|
|
170
|
+
- `small`: show thumbnails at 24px tall.
|
|
171
|
+
- `medium`: show thumbnails at 32px tall.
|
|
172
|
+
- `large`: show thumbnails at 40px tall.
|
|
173
|
+
- `Object`: configure the navbar with the following properties:
|
|
174
|
+
- `show` (`Boolean` or `Number`): specify the visibility of the navbar.
|
|
175
|
+
- `size` (`String`): specify the thumbnail size: `small`, `medium`, or `large`.
|
|
176
|
+
- `visibleItemCount` (`Number`): specify the number of thumbnail items to render around the active item. The default is calculated from the container width and the width of one thumbnail item.
|
|
167
177
|
|
|
168
178
|
Specify the visibility of the navbar.
|
|
169
179
|
|
|
180
|
+
When setting a size, thumbnails use a $9 / 16$ width-to-height ratio.
|
|
181
|
+
|
|
182
|
+
```js
|
|
183
|
+
navbar: {
|
|
184
|
+
show: true,
|
|
185
|
+
size: 'large',
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### navigation
|
|
190
|
+
|
|
191
|
+
- Type: `Boolean` or `Number` or `Object`
|
|
192
|
+
- Default: `false`
|
|
193
|
+
|
|
194
|
+
- Options:
|
|
195
|
+
- `0` or `false`: hide the navigation buttons.
|
|
196
|
+
- `1` or `true`: show the navigation buttons.
|
|
197
|
+
- `2`: show the navigation buttons only when the screen width is greater than 768 pixels.
|
|
198
|
+
- `3`: show the navigation buttons only when the screen width is greater than 992 pixels.
|
|
199
|
+
- `4`: show the navigation buttons only when the screen width is greater than 1200 pixels.
|
|
200
|
+
- `{ prev: Boolean | Number | Object, next: Boolean | Number | Object }`: show or hide each navigation button.
|
|
201
|
+
- `{ prev: { show: Boolean | Number, size: String }, next: { show: Boolean | Number, size: String } }`: customize each navigation button.
|
|
202
|
+
- Available sizes: `small` (32px), `medium` (40px, default), and `large` (48px).
|
|
203
|
+
|
|
204
|
+
Show the previous and next buttons on the left and right sides of the viewer.
|
|
205
|
+
|
|
206
|
+
For example:
|
|
207
|
+
|
|
208
|
+
```js
|
|
209
|
+
new Viewer(image, {
|
|
210
|
+
navigation: {
|
|
211
|
+
prev: {
|
|
212
|
+
size: 'large',
|
|
213
|
+
},
|
|
214
|
+
next: {
|
|
215
|
+
show: 2,
|
|
216
|
+
size: 'small',
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
170
222
|
### title
|
|
171
223
|
|
|
172
224
|
- Type: `Boolean` or `Number` or `Function` or `Array`
|
|
@@ -178,9 +230,9 @@ Specify the visibility of the navbar.
|
|
|
178
230
|
- `3`: show the title only when the screen width is greater than 992 pixels
|
|
179
231
|
- `4`: show the title only when the screen width is greater than 1200 pixels
|
|
180
232
|
- `Function`: customize the title content
|
|
181
|
-
- `[Number, Function]`: the first element
|
|
233
|
+
- `[Number, Function]`: the first element indicates the visibility; the second element customizes the title content
|
|
182
234
|
|
|
183
|
-
Specify the visibility and
|
|
235
|
+
Specify the visibility and content of the title.
|
|
184
236
|
|
|
185
237
|
> The name comes from the `alt` attribute of an image element or the image name parsed from its URL.
|
|
186
238
|
|
|
@@ -209,7 +261,7 @@ new Viewer(image, {
|
|
|
209
261
|
- Available built-in keys: "zoomIn", "zoomOut", "oneToOne", "reset", "prev", "play", "next", "rotateLeft", "rotateRight", "flipHorizontal", "flipVertical".
|
|
210
262
|
- Available built-in sizes: "small", "medium" (default) and "large".
|
|
211
263
|
|
|
212
|
-
Specify the visibility and layout of the toolbar its buttons.
|
|
264
|
+
Specify the visibility and layout of the toolbar and its buttons.
|
|
213
265
|
|
|
214
266
|
For example, `toolbar: 4` equals to:
|
|
215
267
|
|
|
@@ -295,7 +347,7 @@ Define the extra attributes to inherit from the original image.
|
|
|
295
347
|
- Type: `Number`
|
|
296
348
|
- Default: `0.9`
|
|
297
349
|
|
|
298
|
-
Define the initial coverage of the viewing image. It must a positive number between 0 (0%) and 1 (100%).
|
|
350
|
+
Define the initial coverage of the viewing image. It must be a positive number between 0 (0%) and 1 (100%).
|
|
299
351
|
|
|
300
352
|
### initialViewIndex
|
|
301
353
|
|
|
@@ -313,6 +365,13 @@ Define the initial index of the image for viewing.
|
|
|
313
365
|
|
|
314
366
|
Enable inline mode.
|
|
315
367
|
|
|
368
|
+
### autoplay
|
|
369
|
+
|
|
370
|
+
- Type: `Boolean`
|
|
371
|
+
- Default: `true`
|
|
372
|
+
|
|
373
|
+
Enable to automatically cycle the images when playing.
|
|
374
|
+
|
|
316
375
|
### interval
|
|
317
376
|
|
|
318
377
|
- Type: `Number`
|
|
@@ -352,6 +411,13 @@ Indicate if enabling loop viewing or not.
|
|
|
352
411
|
|
|
353
412
|
> If the current image is the last one, then the next one to view is the first one, and vice versa.
|
|
354
413
|
|
|
414
|
+
### preload
|
|
415
|
+
|
|
416
|
+
- Type: `Boolean`
|
|
417
|
+
- Default: `true`
|
|
418
|
+
|
|
419
|
+
Enable to preload the next or previous image before viewing it.
|
|
420
|
+
|
|
355
421
|
### minWidth
|
|
356
422
|
|
|
357
423
|
- Type: `Number`
|
|
@@ -377,6 +443,29 @@ Define the minimum height of the viewer.
|
|
|
377
443
|
|
|
378
444
|
Enable to move the image.
|
|
379
445
|
|
|
446
|
+
### magnifier
|
|
447
|
+
|
|
448
|
+
- Type: `Boolean` or `Object`
|
|
449
|
+
- Default: `false`
|
|
450
|
+
- Options:
|
|
451
|
+
- `size` (`Number`): the size of the magnifier in pixels. Defaults to `100`.
|
|
452
|
+
- `zoomRatio` (`Number`): the magnification ratio. Defaults to `2`.
|
|
453
|
+
- `opacity` (`Number`): the opacity of the magnifier, from `0` to `1`. Defaults to `1`.
|
|
454
|
+
|
|
455
|
+
Show a magnifier over the image when hovering in fullscreen mode. The magnifier is disabled on touch screens.
|
|
456
|
+
|
|
457
|
+
For example:
|
|
458
|
+
|
|
459
|
+
```js
|
|
460
|
+
new Viewer(image, {
|
|
461
|
+
magnifier: {
|
|
462
|
+
size: 120,
|
|
463
|
+
zoomRatio: 3,
|
|
464
|
+
opacity: 0.8,
|
|
465
|
+
},
|
|
466
|
+
});
|
|
467
|
+
```
|
|
468
|
+
|
|
380
469
|
### rotatable
|
|
381
470
|
|
|
382
471
|
- Type: `Boolean`
|
|
@@ -384,6 +473,20 @@ Enable to move the image.
|
|
|
384
473
|
|
|
385
474
|
Enable to rotate the image.
|
|
386
475
|
|
|
476
|
+
### rotateOnGesture
|
|
477
|
+
|
|
478
|
+
- Type: `Boolean`
|
|
479
|
+
- Default: `true`
|
|
480
|
+
|
|
481
|
+
Enable to rotate the current image with gesture events, such as a two-finger gesture on Mac Safari.
|
|
482
|
+
|
|
483
|
+
### rotateOnTouch
|
|
484
|
+
|
|
485
|
+
- Type: `Boolean`
|
|
486
|
+
- Default: `true`
|
|
487
|
+
|
|
488
|
+
Enable to rotate the current image with a two-finger gesture on a touch screen.
|
|
489
|
+
|
|
387
490
|
### scalable
|
|
388
491
|
|
|
389
492
|
- Type: `Boolean`
|
|
@@ -398,6 +501,13 @@ Enable to scale the image.
|
|
|
398
501
|
|
|
399
502
|
Enable to zoom the image.
|
|
400
503
|
|
|
504
|
+
### zoomOnGesture
|
|
505
|
+
|
|
506
|
+
- Type: `Boolean`
|
|
507
|
+
- Default: `true`
|
|
508
|
+
|
|
509
|
+
Enable to zoom the current image with gesture events, such as a pinch gesture on Mac Safari.
|
|
510
|
+
|
|
401
511
|
### zoomOnTouch
|
|
402
512
|
|
|
403
513
|
- Type: `Boolean`
|
|
@@ -424,9 +534,9 @@ Enable to slide to the next or previous image by swiping on the touch screen.
|
|
|
424
534
|
- Type: `Boolean`
|
|
425
535
|
- Default: `true`
|
|
426
536
|
|
|
427
|
-
Indicate
|
|
537
|
+
Indicate whether to toggle the image size between its natural size and initial size when double-clicking the image.
|
|
428
538
|
|
|
429
|
-
In other words, call the [`toggle`](#toggle) method automatically when
|
|
539
|
+
In other words, call the [`toggle`](#toggle) method automatically when the image is double-clicked.
|
|
430
540
|
|
|
431
541
|
> Requires [`dblclick`](https://developer.mozilla.org/en-US/docs/Web/Events/dblclick) event support.
|
|
432
542
|
|
|
@@ -439,10 +549,22 @@ Show the tooltip with image ratio (percentage) when zooming in or zooming out.
|
|
|
439
549
|
|
|
440
550
|
### transition
|
|
441
551
|
|
|
442
|
-
- Type: `Boolean`
|
|
552
|
+
- Type: `Boolean` or `Object`
|
|
443
553
|
- Default: `true`
|
|
444
554
|
|
|
445
|
-
Enable CSS3
|
|
555
|
+
Enable CSS3 transitions for some special elements.
|
|
556
|
+
|
|
557
|
+
When passing an object, set a supported action to `false` to disable only its transition. The supported actions are `show`, `hide`, `view`, `move`, `zoom`, `rotate`, `scale`, `play`, and `tooltip`.
|
|
558
|
+
|
|
559
|
+
```js
|
|
560
|
+
new Viewer(image, {
|
|
561
|
+
transition: {
|
|
562
|
+
hide: false,
|
|
563
|
+
view: false,
|
|
564
|
+
zoom: false,
|
|
565
|
+
},
|
|
566
|
+
});
|
|
567
|
+
```
|
|
446
568
|
|
|
447
569
|
### zIndex
|
|
448
570
|
|
|
@@ -467,18 +589,38 @@ Define the ratio when zooming the image by wheeling the mouse.
|
|
|
467
589
|
|
|
468
590
|
### minZoomRatio
|
|
469
591
|
|
|
470
|
-
- Type: `Number`
|
|
592
|
+
- Type: `Number` or `Function`
|
|
471
593
|
- Default: `0.01`
|
|
472
594
|
|
|
473
595
|
Define the min ratio of the image when zooming out.
|
|
474
596
|
|
|
597
|
+
If it is a function, it receives the current image and image data, and should return the minimum ratio:
|
|
598
|
+
|
|
599
|
+
```js
|
|
600
|
+
new Viewer(image, {
|
|
601
|
+
minZoomRatio(image, imageData) {
|
|
602
|
+
return imageData.naturalWidth > 2000 ? 0.1 : 0.01;
|
|
603
|
+
},
|
|
604
|
+
});
|
|
605
|
+
```
|
|
606
|
+
|
|
475
607
|
### maxZoomRatio
|
|
476
608
|
|
|
477
|
-
- Type: `Number`
|
|
609
|
+
- Type: `Number` or `Function`
|
|
478
610
|
- Default: `100`
|
|
479
611
|
|
|
480
612
|
Define the max ratio of the image when zooming in.
|
|
481
613
|
|
|
614
|
+
If it is a function, it receives the current image and image data, and should return the maximum ratio:
|
|
615
|
+
|
|
616
|
+
```js
|
|
617
|
+
new Viewer(image, {
|
|
618
|
+
maxZoomRatio(image, imageData) {
|
|
619
|
+
return imageData.naturalWidth > 2000 ? 2 : 10;
|
|
620
|
+
},
|
|
621
|
+
});
|
|
622
|
+
```
|
|
623
|
+
|
|
482
624
|
### url
|
|
483
625
|
|
|
484
626
|
- Type: `String` or `Function`
|
|
@@ -626,9 +768,9 @@ Shortcut of the `stop` event.
|
|
|
626
768
|
|
|
627
769
|
## Methods
|
|
628
770
|
|
|
629
|
-
All methods
|
|
771
|
+
All methods support chain composition.
|
|
630
772
|
|
|
631
|
-
As there are some **asynchronous** processes when
|
|
773
|
+
As there are some **asynchronous** processes when starting the viewer, you should call a method only when it is available. See the following **lifecycle**:
|
|
632
774
|
|
|
633
775
|
```js
|
|
634
776
|
new Viewer(image, {
|
|
@@ -856,9 +998,9 @@ viewer.zoomTo(0); // Zoom to zero size (0%)
|
|
|
856
998
|
viewer.zoomTo(1); // Zoom to natural size (100%)
|
|
857
999
|
|
|
858
1000
|
// Zoom to 50% from the center of the window.
|
|
859
|
-
viewer.zoomTo(.5, {
|
|
1001
|
+
viewer.zoomTo(0.5, false, {
|
|
860
1002
|
x: window.innerWidth / 2,
|
|
861
|
-
y:
|
|
1003
|
+
y: window.innerHeight / 2,
|
|
862
1004
|
});
|
|
863
1005
|
```
|
|
864
1006
|
|
|
@@ -867,7 +1009,7 @@ viewer.zoomTo(.5, {
|
|
|
867
1009
|
- **fullscreen** (optional):
|
|
868
1010
|
- Type: `Boolean` or [`FullscreenOptions`](https://developer.mozilla.org/en-US/docs/Web/API/FullscreenOptions)
|
|
869
1011
|
- Default: `false`
|
|
870
|
-
-
|
|
1012
|
+
- Indicates whether to request fullscreen.
|
|
871
1013
|
|
|
872
1014
|
Play the images.
|
|
873
1015
|
|
|
@@ -903,18 +1045,61 @@ Toggle the image size between its current size and natural size.
|
|
|
903
1045
|
|
|
904
1046
|
Reset the image to its initial state.
|
|
905
1047
|
|
|
906
|
-
### update()
|
|
1048
|
+
### update([options])
|
|
907
1049
|
|
|
908
|
-
Update the viewer instance when the source images changed (added, removed, or sorted).
|
|
1050
|
+
Update the viewer instance when the source images changed (added, removed, or sorted), or update the options while the viewer is open.
|
|
909
1051
|
|
|
910
1052
|
> If you load images dynamically (with XMLHTTPRequest), you can use this method to add the new images to the viewer instance.
|
|
911
1053
|
|
|
1054
|
+
```js
|
|
1055
|
+
viewer.update({
|
|
1056
|
+
slideOnTouch: false,
|
|
1057
|
+
});
|
|
1058
|
+
```
|
|
1059
|
+
|
|
912
1060
|
### destroy()
|
|
913
1061
|
|
|
914
1062
|
Destroy the viewer and remove the instance.
|
|
915
1063
|
|
|
916
1064
|
[⬆ back to top](#table-of-contents)
|
|
917
1065
|
|
|
1066
|
+
## Static Methods
|
|
1067
|
+
|
|
1068
|
+
### create(element[, options])
|
|
1069
|
+
|
|
1070
|
+
Create a new `Viewer` instance without using the `new` operator.
|
|
1071
|
+
|
|
1072
|
+
```js
|
|
1073
|
+
const viewer = Viewer.create(image, {
|
|
1074
|
+
inline: true,
|
|
1075
|
+
});
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
### setDefaults(options)
|
|
1079
|
+
|
|
1080
|
+
Change the global default options for subsequently created `Viewer` instances. Instance options override these defaults.
|
|
1081
|
+
|
|
1082
|
+
```js
|
|
1083
|
+
Viewer.setDefaults({
|
|
1084
|
+
inline: true,
|
|
1085
|
+
});
|
|
1086
|
+
```
|
|
1087
|
+
|
|
1088
|
+
### noConflict
|
|
1089
|
+
|
|
1090
|
+
If you have to use another viewer with the same namespace, call the `Viewer.noConflict` static method to revert to it.
|
|
1091
|
+
|
|
1092
|
+
```html
|
|
1093
|
+
<script src="other-viewer.js"></script>
|
|
1094
|
+
<script src="viewer.js"></script>
|
|
1095
|
+
<script>
|
|
1096
|
+
Viewer.noConflict();
|
|
1097
|
+
// Code that uses other `Viewer` can follow here.
|
|
1098
|
+
</script>
|
|
1099
|
+
```
|
|
1100
|
+
|
|
1101
|
+
[⬆ back to top](#table-of-contents)
|
|
1102
|
+
|
|
918
1103
|
## Events
|
|
919
1104
|
|
|
920
1105
|
All events can access the viewer instance with `this.viewer` in its handler.
|
|
@@ -1130,20 +1315,7 @@ This event fires when the viewer starts to stop.
|
|
|
1130
1315
|
|
|
1131
1316
|
[⬆ back to top](#table-of-contents)
|
|
1132
1317
|
|
|
1133
|
-
##
|
|
1134
|
-
|
|
1135
|
-
If you have to use another viewer with the same namespace, call the `Viewer.noConflict` static method to revert to it.
|
|
1136
|
-
|
|
1137
|
-
```html
|
|
1138
|
-
<script src="other-viewer.js"></script>
|
|
1139
|
-
<script src="viewer.js"></script>
|
|
1140
|
-
<script>
|
|
1141
|
-
Viewer.noConflict();
|
|
1142
|
-
// Code that uses other `Viewer` can follow here.
|
|
1143
|
-
</script>
|
|
1144
|
-
```
|
|
1145
|
-
|
|
1146
|
-
## Browser support
|
|
1318
|
+
## Browser Support
|
|
1147
1319
|
|
|
1148
1320
|
- Chrome (latest)
|
|
1149
1321
|
- Firefox (latest)
|