js-cloudimage-360-view 3.0.0-beta.2 → 3.0.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/CHANGELOG.md +93 -0
- package/LICENSE +13 -1
- package/README.md +361 -127
- package/dist/ci360.service.js +882 -1157
- package/dist/ci360.utils.js +28 -204
- package/dist/constants/auto-play-behavior.js +13 -0
- package/dist/constants/falsy-values.js +8 -0
- package/dist/constants/index.js +43 -0
- package/dist/constants/orientations.js +12 -0
- package/dist/constants/props-require-reload.js +21 -0
- package/dist/constants/regex.js +10 -0
- package/dist/index.js +73 -12
- package/dist/static/css/hotspots.css +229 -0
- package/dist/static/css/style.css +113 -4
- package/dist/utils/auto-play/get-speed-factor.js +14 -0
- package/dist/utils/auto-play/is-completed-one-cycle.js +32 -0
- package/dist/utils/auto-play/loop.js +67 -0
- package/dist/utils/class-names/add-class.js +18 -0
- package/dist/utils/class-names/remove-class.js +16 -0
- package/dist/utils/container-elements/apply-styles-to-container.js +16 -0
- package/dist/utils/container-elements/create-360-view-circle-icon.js +16 -0
- package/dist/utils/container-elements/create-360-view-icon.js +15 -0
- package/dist/utils/container-elements/create-box-shadow.js +16 -0
- package/dist/utils/container-elements/create-canvas.js +16 -0
- package/dist/utils/container-elements/create-close-fullscreen-icon.js +14 -0
- package/dist/utils/container-elements/create-fullscreen-icon.js +14 -0
- package/dist/utils/container-elements/create-fullscreen-modal.js +20 -0
- package/dist/utils/container-elements/create-icons-container.js +15 -0
- package/dist/utils/container-elements/create-inner-box.js +15 -0
- package/dist/utils/container-elements/create-loader.js +15 -0
- package/dist/utils/container-elements/create-magnifier-icon.js +14 -0
- package/dist/utils/container-elements/index.js +109 -0
- package/dist/utils/container-elements/remove-child-from-parent.js +16 -0
- package/dist/utils/controls/get-item-skipped.js +13 -0
- package/dist/utils/controls/init-controls.js +77 -0
- package/dist/utils/hotspots/attach-events/hide-popup.js +15 -0
- package/dist/utils/hotspots/attach-events/show-popup.js +14 -0
- package/dist/utils/hotspots/configs-error-handler.js +27 -0
- package/dist/utils/hotspots/create-popper-instace.js +32 -0
- package/dist/utils/hotspots/elements/create-carousel-dot.js +26 -0
- package/dist/utils/hotspots/elements/create-carousel-image.js +22 -0
- package/dist/utils/hotspots/elements/create-hotspot-icon.js +66 -0
- package/dist/utils/hotspots/elements/create-hotspot-popup-link.js +23 -0
- package/dist/utils/hotspots/elements/create-hotspots.js +25 -0
- package/dist/utils/hotspots/elements/create-images-carousel.js +27 -0
- package/dist/utils/hotspots/elements/create-modal-description.js +15 -0
- package/dist/utils/hotspots/elements/create-modal-title.js +15 -0
- package/dist/utils/hotspots/elements/create-model-elements.js +66 -0
- package/dist/utils/hotspots/elements/create-popup-arrow.js +16 -0
- package/dist/utils/hotspots/elements/create-popup.js +67 -0
- package/dist/utils/hotspots/elements/create-read-more-btn.js +17 -0
- package/dist/utils/hotspots/fill-empty-coord-with-previous.js +26 -0
- package/dist/utils/hotspots/generate-hotspots-configs.js +58 -0
- package/dist/utils/hotspots/generate-popup-config.js +29 -0
- package/dist/utils/hotspots/get-hotspot-icon.js +14 -0
- package/dist/utils/hotspots/get-hotspot-orientation.js +21 -0
- package/dist/utils/hotspots/get-hotspot-popup-node.js +14 -0
- package/dist/utils/hotspots/get-popup-node.js +14 -0
- package/dist/utils/hotspots/hide-hotspot-icon.js +13 -0
- package/dist/utils/hotspots/hide-hotspots-icons.js +18 -0
- package/dist/utils/hotspots/is-mouse-on-hotspot.js +14 -0
- package/dist/utils/hotspots/prepare-hotspots-positions.js +28 -0
- package/dist/utils/hotspots/set-current-slide.js +23 -0
- package/dist/utils/hotspots/toggle-popup-events.js +23 -0
- package/dist/utils/hotspots/update-hotspot-icon-position.js +21 -0
- package/dist/utils/hotspots/update-hotspots.js +48 -0
- package/dist/utils/image-src/generate-images-path.js +40 -0
- package/dist/utils/image-src/is-props-change-require-reload.js +23 -0
- package/dist/utils/index.js +237 -0
- package/dist/utils/load-images/images-from-folder/prepare-images-from-folder.js +34 -0
- package/dist/utils/load-images/images-from-list/prepare-images-from-list.js +35 -0
- package/dist/utils/load-images/lazyload/init-lazyload.js +49 -0
- package/dist/utils/load-images/lazyload/prepare-first-image/prepare-first-image-from-folder.js +18 -0
- package/dist/utils/load-images/lazyload/prepare-first-image/prepare-first-image-from-list.js +29 -0
- package/dist/utils/load-images/load-image-as-promise.js +54 -0
- package/dist/utils/load-images/load-images-relative-to-container-size.js +58 -0
- package/dist/utils/load-images/load-original-images.js +58 -0
- package/dist/utils/load-images/pad.js +14 -0
- package/dist/utils/load-images/preload-images.js +35 -0
- package/dist/utils/load-images/preload-original-images.js +35 -0
- package/dist/utils/magnify/get-current-original-image.js +29 -0
- package/dist/utils/magnify/get-cursor-position.js +24 -0
- package/dist/utils/magnify/magnify.js +54 -0
- package/dist/utils/magnify/move-magnifier.js +47 -0
- package/dist/utils/responsive/contain.js +11 -0
- package/dist/utils/responsive/fit.js +33 -0
- package/dist/utils/responsive/get-image-aspect-ratio.js +39 -0
- package/dist/utils/responsive/get-responsive-width-of-container.js +14 -0
- package/dist/utils/responsive/get-size-according-to-pixel-ratio.js +17 -0
- package/dist/utils/responsive/get-size-limit.js +14 -0
- package/dist/utils/spin-y/get-moving-direction.js +21 -0
- package/dist/utils/zoom/generate-zoom-in-steps.js +20 -0
- package/dist/utils/zoom/generate-zoom-out-steps.js +20 -0
- package/package.json +13 -8
- package/dist/ci360.constants.js +0 -36
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
[](https://github.com/scaleflex/js-cloudimage-360-view/releases)
|
|
2
3
|
[](#contributing)
|
|
3
4
|
[](https://opensource.org/licenses/MIT)
|
|
4
|
-
[](https://www.scaleflex.
|
|
5
|
+
[](https://www.scaleflex.com/en/home)
|
|
5
6
|
|
|
6
7
|
[](https://twitter.com/intent/tweet?text=Engage%20your%20customers%20with%20a%20stunning%20360%20viewvof%20your%20products&url=https://scaleflex.github.io/js-cloudimage-360-view/&via=cloudimage&hashtags=images,cloudimage)
|
|
7
8
|
|
|
8
9
|
<p align="center">
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
src="https://demo.cloudimg.io/v7/https://scaleflex.airstore.io/filerobot/filerobot-cloudimage.png?sanitize=true">
|
|
10
|
+
<img
|
|
11
|
+
alt="The Lounge"
|
|
12
|
+
src="https://scaleflex.cloudimg.io/v7/cloudimage.io/LOGO+WITH+SCALEFLEX-01.png?vh=f6080d&w=350">
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<h1 align="center">
|
|
@@ -31,15 +31,14 @@
|
|
|
31
31
|
</p>
|
|
32
32
|
|
|
33
33
|
A simple, interactive resource that can be used to provide a virtual tour of your product.
|
|
34
|
-
|
|
35
|
-
<p align="center">
|
|
34
|
+
<p align="left">
|
|
36
35
|
<img
|
|
37
36
|
alt="The Lounge"
|
|
38
|
-
src="https://scaleflex.
|
|
37
|
+
src="https://scaleflex.cloudimg.io/v7/filerobot/js-cloudimage-360-view/demo-min.gif?vh=ecac07">
|
|
39
38
|
</p>
|
|
40
39
|
|
|
41
40
|
powered by [Cloudimage](https://www.cloudimage.io/)
|
|
42
|
-
([Watch the video here](https://www.youtube.com/watch?
|
|
41
|
+
([Watch the video here](https://www.youtube.com/watch?v=tk4j_MpqvM8))
|
|
43
42
|
|
|
44
43
|
## <a name="table_of_contents"></a>Table of contents
|
|
45
44
|
|
|
@@ -47,9 +46,10 @@ powered by [Cloudimage](https://www.cloudimage.io/)
|
|
|
47
46
|
* [Step 1: Installation](#installation)
|
|
48
47
|
* [Step 2: Initialize](#initialize)
|
|
49
48
|
* [Methods](#methods)
|
|
50
|
-
* [Customize
|
|
49
|
+
* [Customize elements](#customize-elements)
|
|
51
50
|
* [Configuration](#configuration)
|
|
52
51
|
* [Controls](#controls)
|
|
52
|
+
* [Hotspots](#hotspots)
|
|
53
53
|
* [Cloudimage responsive integration](#cloudimage-responsive-integration)
|
|
54
54
|
* [Lazy loading integration](#lazy-loading)
|
|
55
55
|
* [Best practices](#best-practices)
|
|
@@ -69,7 +69,7 @@ To see the Cloudimage 360 view plugin in action, please check out the
|
|
|
69
69
|
Add script tag with CDN link to js-cloudimage-360-view lib after all content in body tag
|
|
70
70
|
|
|
71
71
|
```javascript
|
|
72
|
-
<script src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/
|
|
72
|
+
<script src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/3.0.0/js-cloudimage-360-view.min.js"></script>
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
## <a name="initialize"></a>Step 2: Initialize
|
|
@@ -80,9 +80,10 @@ After adding the js-cloudimage-360-view lib, simply initialize it with **class n
|
|
|
80
80
|
```html
|
|
81
81
|
<div
|
|
82
82
|
class="cloudimage-360"
|
|
83
|
-
|
|
84
|
-
data-
|
|
85
|
-
data-
|
|
83
|
+
id="gurkha-suv"
|
|
84
|
+
data-folder="https://scaleflex.cloudimg.io/v7/demo/suv-orange-car-360/"
|
|
85
|
+
data-filename-x="orange-{index}.jpg"
|
|
86
|
+
data-amount-x="73"
|
|
86
87
|
></div>
|
|
87
88
|
```
|
|
88
89
|
|
|
@@ -103,10 +104,54 @@ window.CI360.init();
|
|
|
103
104
|
> NOTE: initialization of the plugin runs on the script load. In case you need to postpone the initialization of the plugin you can disable it with **notInitOnLoad** param
|
|
104
105
|
> ```javascript
|
|
105
106
|
> <script>window.CI360 = { notInitOnLoad: true }</script>
|
|
106
|
-
> <script src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/
|
|
107
|
+
> <script src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/3.0.0/js-cloudimage-360-view.min.js"></script>
|
|
107
108
|
> <script>window.CI360.init(); // initialize the plugin when you need</script>
|
|
108
109
|
> ```
|
|
109
110
|
|
|
111
|
+
### add
|
|
112
|
+
|
|
113
|
+
###### Type: **Function**
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
window.CI360.add(idOftheView: string);
|
|
117
|
+
```
|
|
118
|
+
lazy init cloudimage-360 view by id.
|
|
119
|
+
### Properties
|
|
120
|
+
#### `idOftheView`: string
|
|
121
|
+
The id of the new view
|
|
122
|
+
|
|
123
|
+
### update
|
|
124
|
+
|
|
125
|
+
###### Type: **Function**
|
|
126
|
+
```javascript
|
|
127
|
+
window.CI360.update(idOftheView, forceUpdate);
|
|
128
|
+
```
|
|
129
|
+
Update cloudimage 360 viewer instance.<br/>
|
|
130
|
+
For any update in source attributes after plugin initialization (e.g. `data-folder`, `data-filename-x`, `data-amount-y`),
|
|
131
|
+
the plugin will re-init.
|
|
132
|
+
### Properties
|
|
133
|
+
#### `idOftheView`: string
|
|
134
|
+
The id of the new view
|
|
135
|
+
#### `forceUpdate`: bool
|
|
136
|
+
Force the view to reinitialize.
|
|
137
|
+
|
|
138
|
+
```html
|
|
139
|
+
<div
|
|
140
|
+
class="cloudimage-360"
|
|
141
|
+
id="gurkha-suv"
|
|
142
|
+
data-folder="https://scaleflex.cloudimg.io/v7/demo/suv-orange-car-360/"
|
|
143
|
+
data-filename-x="orange-{index}.jpg"
|
|
144
|
+
data-amount-x="73"
|
|
145
|
+
></div>
|
|
146
|
+
```
|
|
147
|
+
```javascript
|
|
148
|
+
window.CI360.update('gurkha-suv');
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
window.CI360.update(null, true);
|
|
153
|
+
```
|
|
154
|
+
|
|
110
155
|
### destroy
|
|
111
156
|
|
|
112
157
|
###### Type: **Function**
|
|
@@ -126,25 +171,51 @@ window.CI360.destroy();
|
|
|
126
171
|
Get the {index} of the image that is being viewed.
|
|
127
172
|
|
|
128
173
|
```javascript
|
|
129
|
-
window.CI360.getActiveIndexByID(
|
|
174
|
+
window.CI360.getActiveIndexByID(idOfInstance: string, oriantation: string);
|
|
130
175
|
```
|
|
131
|
-
|
|
176
|
+
### Properties
|
|
177
|
+
#### `idOfInstance`: string
|
|
178
|
+
The id of the instance
|
|
179
|
+
|
|
180
|
+
#### `oriantation`: string
|
|
181
|
+
The oriantation of the active index
|
|
182
|
+
|
|
183
|
+
## <a name="customize-elements"></a> Customize elements
|
|
132
184
|
|
|
133
|
-
You can customize
|
|
185
|
+
You can customize elements by adding the following classes:
|
|
134
186
|
|
|
135
187
|
### Example CSS
|
|
136
188
|
```css
|
|
137
|
-
.cloudimage-360
|
|
138
|
-
|
|
189
|
+
.cloudimage-360-icons-container {
|
|
190
|
+
top: 5px;
|
|
191
|
+
right: 5px;
|
|
139
192
|
}
|
|
140
|
-
.cloudimage-360
|
|
193
|
+
.cloudimage-360-fullscreen-modal {
|
|
194
|
+
top: 0;
|
|
195
|
+
bottom: 0;
|
|
196
|
+
}
|
|
197
|
+
.cloudimage-360-magnifier-icon {
|
|
141
198
|
background: url(https://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/loupe.svg) 50% 50% / cover no-repeat;
|
|
142
199
|
}
|
|
143
|
-
.cloudimage-360
|
|
200
|
+
.cloudimage-360-close-fullscreen-icon {
|
|
144
201
|
background: url(https://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/cross.svg) 50% 50% / cover no-repeat;
|
|
145
202
|
}
|
|
146
|
-
.cloudimage-360
|
|
147
|
-
|
|
203
|
+
.cloudimage-360-view-360-circle {
|
|
204
|
+
margin: auto;
|
|
205
|
+
}
|
|
206
|
+
.cloudimage-360-loader {
|
|
207
|
+
margin: auto;
|
|
208
|
+
}
|
|
209
|
+
.cloudimage-360-view-360-icon {
|
|
210
|
+
background: url(hhttps://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/360_view.svg) 50% 50% / cover no-repeat;
|
|
211
|
+
}
|
|
212
|
+
.cloudimage-360-box-shadow {
|
|
213
|
+
top: 0;
|
|
214
|
+
left: 0;
|
|
215
|
+
}
|
|
216
|
+
.cloudimage-360-img-magnifier-glass {
|
|
217
|
+
border: 3px solid #000;
|
|
218
|
+
border-radius: 50%;
|
|
148
219
|
}
|
|
149
220
|
```
|
|
150
221
|
|
|
@@ -161,24 +232,35 @@ The selector for js-cloudimage-360-view lib.
|
|
|
161
232
|
###### Type: **String(url)** | _required_
|
|
162
233
|
|
|
163
234
|
Your images folder on server.
|
|
235
|
+
### data-api-version (or api-version)
|
|
164
236
|
|
|
165
|
-
|
|
237
|
+
###### Type: **String** |Default: **'v7'** | _optional_
|
|
238
|
+
|
|
239
|
+
Allow to use a specific version of API.
|
|
240
|
+
|
|
241
|
+
- set a specific version of API
|
|
242
|
+
```javascript
|
|
243
|
+
data-api-version="v7"
|
|
244
|
+
```
|
|
245
|
+
- disable API version
|
|
246
|
+
```javascript
|
|
247
|
+
data-api-version="null"
|
|
248
|
+
```
|
|
249
|
+
### data-filename-x (or filename-x)
|
|
166
250
|
|
|
167
251
|
###### Type: **String** | Default: **image-{index}.jpg** | _optional_
|
|
168
252
|
|
|
169
|
-
The filename pattern for your 360 image.
|
|
253
|
+
The filename pattern for your 360 image. Must include {index}, which the library will replace with a number between 1 and [data-amount-x](#data-amount-x).
|
|
170
254
|
|
|
171
255
|
### data-filename-y (or filename-y)
|
|
172
256
|
|
|
173
257
|
###### Type: **String** | Default: **image-y-{index}.jpg** | _optional_
|
|
258
|
+
The same for [data-amount-x](#data-amount-x) but for images set in Y-axis.
|
|
174
259
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
### <a name="data-amount"></a> data-amount (or amount)
|
|
178
|
-
|
|
260
|
+
### <a name="data-amount-x"></a> data-amount-x (or amount-x)
|
|
179
261
|
###### Type: **Number** | Default: **36** | _optional_
|
|
180
262
|
|
|
181
|
-
Amount of images to load for 360 view.
|
|
263
|
+
Amount of images to load in X-axis for 360 view .
|
|
182
264
|
|
|
183
265
|
### <a name="data-amount-y"></a> data-amount-y (or amount-y)
|
|
184
266
|
|
|
@@ -192,12 +274,24 @@ Amount of images to load in Y-axis for 360 view.
|
|
|
192
274
|
|
|
193
275
|
Support for 360 spin by pressing arrow keys on keyboard.
|
|
194
276
|
|
|
277
|
+
### data-keys-reverse (or keys-reverse)
|
|
278
|
+
|
|
279
|
+
###### Type: **Bool** | Default: **false** | _optional_
|
|
280
|
+
|
|
281
|
+
invert arrow keys on keyboard.
|
|
282
|
+
|
|
195
283
|
### data-autoplay (or autoplay)
|
|
196
284
|
|
|
197
285
|
###### Type: **Bool** | Default: **false** | _optional_
|
|
198
286
|
|
|
199
287
|
Autoplay 360 spin view on load.
|
|
200
288
|
|
|
289
|
+
### data-play-once (or autoplay)
|
|
290
|
+
|
|
291
|
+
###### Type: **Bool** | Default: **false** | _optional_
|
|
292
|
+
|
|
293
|
+
stops the autoplay after one complete cycle.
|
|
294
|
+
|
|
201
295
|
### data-autoplay-behavior (or autoplay-behavior)
|
|
202
296
|
|
|
203
297
|
###### Type: **String** | Default: **spin-x** | _optional_
|
|
@@ -206,8 +300,7 @@ Changing autoplay behavior
|
|
|
206
300
|
|
|
207
301
|
Available behaviors (spin-x, spin-y, spin-xy, spin-yx)
|
|
208
302
|
|
|
209
|
-
### data-
|
|
210
|
-
|
|
303
|
+
### data-fullscreen (or fullscreen)
|
|
211
304
|
###### Type: **Bool** | Default: **false** | _optional_
|
|
212
305
|
|
|
213
306
|
Open 360 spin view in full screen modal.
|
|
@@ -218,17 +311,46 @@ Open 360 spin view in full screen modal.
|
|
|
218
311
|
|
|
219
312
|
Magnifier to zoom image.
|
|
220
313
|
|
|
221
|
-
### data-
|
|
222
|
-
|
|
223
|
-
|
|
314
|
+
### data-ratio (or ratio)
|
|
315
|
+
###### Type: **Number** (width / height) or JSON object | Default: **none** | _optional_
|
|
316
|
+
#### `ratio`: string
|
|
224
317
|
|
|
225
|
-
|
|
318
|
+
Setting the height relative to the container width according to the provided ratio</br>
|
|
226
319
|
|
|
227
|
-
|
|
320
|
+
```html
|
|
321
|
+
<div
|
|
322
|
+
class="cloudimage-360"
|
|
323
|
+
id="gurkha-suv"
|
|
324
|
+
data-folder="https://scaleflex.cloudimg.io/v7/demo/suv-orange-car-360/"
|
|
325
|
+
data-filename-x="orange-{index}.jpg"
|
|
326
|
+
data-amount-x="73"
|
|
327
|
+
data-ratio="2"
|
|
328
|
+
></div>
|
|
329
|
+
```
|
|
330
|
+
<a href="https://codesandbox.io/s/js-cloudimage-360-view-g4wyt1?file=/index.html"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
331
|
+
#### `ratio`: JSON
|
|
332
|
+
Setting the height relative to the container width at any window size.
|
|
228
333
|
|
|
229
|
-
|
|
334
|
+
In the following example, the height should be 1.3 the container width at window size less than or equal to 567px
|
|
335
|
+
and 2.22 at window size less than or equal to 768px.
|
|
230
336
|
|
|
231
|
-
|
|
337
|
+
```html
|
|
338
|
+
<div
|
|
339
|
+
class="cloudimage-360"
|
|
340
|
+
id="gurkha-suv"
|
|
341
|
+
data-folder="https://scaleflex.cloudimg.io/v7/demo/suv-orange-car-360/"
|
|
342
|
+
data-filename-x="orange-{index}.jpg"
|
|
343
|
+
data-amount-x="73"
|
|
344
|
+
data-ratio='{
|
|
345
|
+
"576": "1.3",
|
|
346
|
+
"768": "2.22",
|
|
347
|
+
"992": "2.23",
|
|
348
|
+
"1200": "3",
|
|
349
|
+
"2400": "3.2"
|
|
350
|
+
}'
|
|
351
|
+
></div>
|
|
352
|
+
```
|
|
353
|
+
<a href="https://codesandbox.io/s/js-cloudimage-360-view-5tssb7?file=/index.html"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
232
354
|
|
|
233
355
|
### data-autoplay-reverse (or autoplay-reverse)
|
|
234
356
|
|
|
@@ -236,6 +358,12 @@ Prevents page from jumping.
|
|
|
236
358
|
|
|
237
359
|
Autoplay 360 spin view on load.
|
|
238
360
|
|
|
361
|
+
### data-disable-drag (or disable-drag)
|
|
362
|
+
|
|
363
|
+
###### Type: **bool** | Default: **false** | _optional_
|
|
364
|
+
|
|
365
|
+
disable mouse drag.
|
|
366
|
+
|
|
239
367
|
### data-speed (or speed)
|
|
240
368
|
|
|
241
369
|
###### Type: **Number** | Default: **150** | _optional_
|
|
@@ -252,7 +380,7 @@ Speed Factor of changing frames on drag event.
|
|
|
252
380
|
|
|
253
381
|
###### Type: **Bool** | Default: **false** | _optional_
|
|
254
382
|
|
|
255
|
-
Spin direction, by default it uses counterclockwise (image indexes from 1 to data-amount).
|
|
383
|
+
Spin direction, by default it uses counterclockwise (image indexes from 1 to data-amount-x).
|
|
256
384
|
|
|
257
385
|
### data-box-shadow (or box-shadow)
|
|
258
386
|
|
|
@@ -272,17 +400,11 @@ Display 360 view line at the bottom of container.
|
|
|
272
400
|
|
|
273
401
|
Hide 360 view icon.
|
|
274
402
|
|
|
275
|
-
### data-logo-src (or logo-src)
|
|
276
|
-
|
|
277
|
-
###### Type: **String** | Default: **https://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/360_view.svg** | _optional_
|
|
278
|
-
|
|
279
|
-
URL of asset to use as the 360 view icon.
|
|
280
|
-
|
|
281
403
|
### data-control-reverse (or control-reverse)
|
|
282
404
|
|
|
283
405
|
###### Type: **Bool** | Default: **false** | _optional_
|
|
284
406
|
|
|
285
|
-
Spin direction using controls, by default it uses counterclockwise (image indexes from 1 to data-amount).
|
|
407
|
+
Spin direction using controls, by default it uses counterclockwise (image indexes from 1 to data-amount-x).
|
|
286
408
|
|
|
287
409
|
### data-stop-at-edges (or stop-at-edges)
|
|
288
410
|
|
|
@@ -302,17 +424,16 @@ Bottom offset for 360 view line.
|
|
|
302
424
|
|
|
303
425
|
Left zero padding on filename. For example: index-zero-base="4" => image index will be "0004"
|
|
304
426
|
|
|
305
|
-
### data-image-list (or image-list)
|
|
306
|
-
|
|
427
|
+
### data-image-list-x (or data-image-list-x)
|
|
307
428
|
###### Type: **Array** | _optional_
|
|
308
429
|
|
|
309
|
-
Option to add list of images instead of `folder` & `
|
|
430
|
+
Option to add list of images in x-oriantation instead of `folder` , `filename-x` & `amount-x`.
|
|
310
431
|
|
|
311
432
|
example:
|
|
312
433
|
|
|
313
434
|
```javascript
|
|
314
435
|
data-folder="https://scaleflex.airstore.io/demo/360-car/"
|
|
315
|
-
data-image-list='[
|
|
436
|
+
data-image-list-x='[
|
|
316
437
|
"iris-1.jpeg",
|
|
317
438
|
"iris-4.jpeg",
|
|
318
439
|
"https://scaleflex.airstore.io/demo/360-car/iris-12.jpeg",
|
|
@@ -320,56 +441,40 @@ data-image-list='[
|
|
|
320
441
|
]’
|
|
321
442
|
```
|
|
322
443
|
|
|
323
|
-
### data-
|
|
324
|
-
|
|
325
|
-
###### Type: **Bool** | Default: **false** | _optional_
|
|
326
|
-
|
|
327
|
-
Only 360 view images close to the client's viewport will be loaded, hence accelerating the page loading time. If set to true, an additional script must be included, see [Lazy loading](#lazy-loading)
|
|
328
|
-
### data-disable-pointer-zoom (or disable-pointer-zoom)
|
|
329
|
-
|
|
330
|
-
###### Type: **bool** | Default: **false** | _optional_
|
|
331
|
-
|
|
332
|
-
Disable pointer zoom on desktop
|
|
333
|
-
|
|
334
|
-
### data-disable-pinch-zoom (or disable-pinch-zoom)
|
|
335
|
-
|
|
336
|
-
###### Type: **bool** | Default: **false** | _optional_
|
|
337
|
-
|
|
338
|
-
Disable pinch zoom on mobile
|
|
339
|
-
### data-to-start-pointer-zoom (or to-start-pointer-zoom)
|
|
444
|
+
### data-image-list-y (or data-image-list-y)
|
|
340
445
|
|
|
341
|
-
###### Type: **
|
|
342
|
-
|
|
343
|
-
Events to start pointer zoom
|
|
344
|
-
|
|
345
|
-
Available events (scroll, click)
|
|
346
|
-
|
|
347
|
-
### data-on-mouse-leave (or on-mouse-leave)
|
|
348
|
-
|
|
349
|
-
###### Type: **string** | Default: **none** | _optional_
|
|
350
|
-
|
|
351
|
-
Functions called after mouse leave the container
|
|
446
|
+
###### Type: **Array** | _optional_
|
|
352
447
|
|
|
353
|
-
|
|
448
|
+
Option to add list of images in y-oriantation instead of `folder` , `filename-y` & `amount-y`.
|
|
354
449
|
|
|
355
|
-
|
|
450
|
+
example:
|
|
356
451
|
|
|
357
|
-
|
|
452
|
+
```javascript
|
|
453
|
+
data-folder="https://scaleflex.airstore.io/demo/360-car/"
|
|
454
|
+
data-image-list-y='[
|
|
455
|
+
"iris-2-y.jpeg",
|
|
456
|
+
"iris-6-y.jpeg",
|
|
457
|
+
"https://scaleflex.airstore.io/demo/360-car/iris-8-y.jpeg",
|
|
458
|
+
"https://scaleflex.airstore.io/demo/360-car/iris-30-y.jpeg"
|
|
459
|
+
]’
|
|
460
|
+
```
|
|
461
|
+
### data-pointer-zoom (or pointer-zoom)
|
|
358
462
|
|
|
359
|
-
###### Type: **Number** | Default: **
|
|
463
|
+
###### Type: **Number** | Default: **none** | _optional_
|
|
360
464
|
|
|
361
|
-
|
|
362
|
-
### data-pinch-zoom-factor (or pinch-zoom-factor)
|
|
465
|
+
Option to scale images on click on it to provided value.
|
|
363
466
|
|
|
364
|
-
|
|
467
|
+
example:
|
|
365
468
|
|
|
366
|
-
|
|
469
|
+
```javascript
|
|
470
|
+
data-pointer-zoom="3"
|
|
471
|
+
```
|
|
367
472
|
|
|
368
|
-
### data-
|
|
473
|
+
### data-lazyload (or lazyload)
|
|
369
474
|
|
|
370
|
-
###### Type: **
|
|
475
|
+
###### Type: **Bool** | Default: **false** | _optional_
|
|
371
476
|
|
|
372
|
-
|
|
477
|
+
Only 360 view images close to the client's viewport will be loaded, hence accelerating the page loading time. If set to true, an additional script must be included, see [Lazy loading](#lazy-loading)
|
|
373
478
|
### data-lazyload-selector (or lazyload-selector)
|
|
374
479
|
|
|
375
480
|
###### Type: **String** | Default: **lazyload** | _optional_
|
|
@@ -379,47 +484,47 @@ Helper class to apply lazy-loading depending on library you choose, see [Lazy lo
|
|
|
379
484
|
|
|
380
485
|
## <a name="controls"></a> Controls
|
|
381
486
|
|
|
382
|
-
You can add controls by adding elements with the following classes: **cloudimage-360-
|
|
487
|
+
You can add controls by adding elements with the following classes: **cloudimage-360-left**, **cloudimage-360-right**, **cloudimage-360-top**, **cloudimage-360-bottom
|
|
383
488
|
|
|
384
489
|
### Example CSS
|
|
385
490
|
```css
|
|
386
|
-
.cloudimage-360 .cloudimage-360-
|
|
491
|
+
.cloudimage-360 .cloudimage-360-left, .cloudimage-360 .cloudimage-360-right {
|
|
387
492
|
padding: 8px;
|
|
388
493
|
background: rgba(255, 255, 255, 0.5);
|
|
389
494
|
border: none;
|
|
390
495
|
border-radius: 4px;
|
|
391
496
|
}
|
|
392
|
-
.cloudimage-360 .cloudimage-360-
|
|
497
|
+
.cloudimage-360 .cloudimage-360-left:focus, .cloudimage-360 .cloudimage-360-right:focus {
|
|
393
498
|
outline: none;
|
|
394
499
|
}
|
|
395
|
-
.cloudimage-360 .cloudimage-360-
|
|
500
|
+
.cloudimage-360 .cloudimage-360-left {
|
|
396
501
|
display: none;
|
|
397
502
|
position: absolute;
|
|
398
503
|
z-index: 100;
|
|
399
504
|
top: calc(50% - 15px);
|
|
400
505
|
left: 20px;
|
|
401
506
|
}
|
|
402
|
-
.cloudimage-360 .cloudimage-360-
|
|
507
|
+
.cloudimage-360 .cloudimage-360-right {
|
|
403
508
|
display: none;
|
|
404
509
|
position: absolute;
|
|
405
510
|
z-index: 100;
|
|
406
511
|
top: calc(50% - 15px);
|
|
407
512
|
right: 20px;
|
|
408
513
|
}
|
|
409
|
-
.cloudimage-360 .cloudimage-360-
|
|
514
|
+
.cloudimage-360 .cloudimage-360-left:before, .cloudimage-360 .cloudimage-360-right:before {
|
|
410
515
|
content: '';
|
|
411
516
|
display: block;
|
|
412
517
|
width: 30px;
|
|
413
518
|
height: 30px;
|
|
414
519
|
background: 50% 50% / cover no-repeat;
|
|
415
520
|
}
|
|
416
|
-
.cloudimage-360 .cloudimage-360-
|
|
521
|
+
.cloudimage-360 .cloudimage-360-left:before {
|
|
417
522
|
background-image: url('https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/assets/img/arrow-left.svg');
|
|
418
523
|
}
|
|
419
|
-
.cloudimage-360 .cloudimage-360-
|
|
524
|
+
.cloudimage-360 .cloudimage-360-right:before {
|
|
420
525
|
background-image: url('https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/assets/img/arrow-right.svg');
|
|
421
526
|
}
|
|
422
|
-
.cloudimage-360 .cloudimage-360-
|
|
527
|
+
.cloudimage-360 .cloudimage-360-left.not-active, .cloudimage-360 .cloudimage-360-right.not-active {
|
|
423
528
|
opacity: 0.4;
|
|
424
529
|
cursor: default;
|
|
425
530
|
}
|
|
@@ -429,16 +534,167 @@ You can add controls by adding elements with the following classes: **cloudimage
|
|
|
429
534
|
<div
|
|
430
535
|
class="cloudimage-360"
|
|
431
536
|
data-folder="https://scaleflex.airstore.io/demo/indoor/"
|
|
432
|
-
data-filename="{index}.jpeg"
|
|
537
|
+
data-filename-x="{index}.jpeg"
|
|
433
538
|
>
|
|
434
|
-
<button class="cloudimage-360-
|
|
435
|
-
<button class="cloudimage-360-
|
|
539
|
+
<button class="cloudimage-360-left"></button>
|
|
540
|
+
<button class="cloudimage-360-right"></button>
|
|
436
541
|
<button class="cloudimage-360-top"></button>
|
|
437
542
|
<button class="cloudimage-360-bottom"></button>
|
|
438
543
|
</div>
|
|
439
544
|
```
|
|
440
545
|
|
|
441
546
|
<a href="https://codesandbox.io/s/js-cloudimage-360-view-361eb?fontsize=14"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
547
|
+
## <a name="hotspots"/> Hotspots or Markers
|
|
548
|
+
Display information about the product on specific areas. Once a hotspot is created it can be used on more than one image.
|
|
549
|
+
### Requirements
|
|
550
|
+
First, we need to set `data-hotspots` attribute to the view we want to add hotspots or markers on it, to prevent the plugin to init the view without hotspots config.
|
|
551
|
+
Also we need to set an `id` attribute, we will need it to link the view with the hotspots config.
|
|
552
|
+
|
|
553
|
+
### Create hotspots configuration
|
|
554
|
+
The hotspots config should be an array of objects, each object in the array indicates a single hotspot config.
|
|
555
|
+
For each item in the array, we need to set the positions (X-coord and Y-coord) of the hotspot at every image index we need to show the hotspot on it. <br>hint: To know the current image index we will need to set `data-info="white || black"` attribute.
|
|
556
|
+
|
|
557
|
+
example:
|
|
558
|
+
|
|
559
|
+
```js
|
|
560
|
+
const HOTSPOTS_CONFIG = [
|
|
561
|
+
{
|
|
562
|
+
positions: [
|
|
563
|
+
{ imageIndex: 0, xCoord: 527, yCoord: 319 },
|
|
564
|
+
{ imageIndex: 1, xCoord: 524 },
|
|
565
|
+
{ imageIndex: 2, xCoord: 520 },
|
|
566
|
+
{ imageIndex: 3, xCoord: 498 },
|
|
567
|
+
{ imageIndex: 4, xCoord: 470 },
|
|
568
|
+
{ imageIndex: 5, xCoord: 441 },
|
|
569
|
+
]
|
|
570
|
+
}
|
|
571
|
+
]
|
|
572
|
+
```
|
|
573
|
+
In the previous example, we have only set the Ycoord a single time at the image index 0.
|
|
574
|
+
So if the coord didn't change there's no need to reset it, it will already take the previous value.
|
|
575
|
+
|
|
576
|
+
Now we need to set the hotspot variant, we have three types of hotspots (link, popup, and custom), as it will be explained below.
|
|
577
|
+
## Variant
|
|
578
|
+
### Link
|
|
579
|
+
we need to provide the URL of the link and the link title.
|
|
580
|
+
|
|
581
|
+
example:
|
|
582
|
+
|
|
583
|
+
```js
|
|
584
|
+
const HOTSPOTS_CONFIG = [
|
|
585
|
+
{
|
|
586
|
+
positions,
|
|
587
|
+
variant: {
|
|
588
|
+
title: 'New Gurkha Technical Specifications',
|
|
589
|
+
url: 'https://www.forcegurkha.co.in/specifications/',
|
|
590
|
+
newTab: true
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
]
|
|
594
|
+
```
|
|
595
|
+
---
|
|
596
|
+
### Popup
|
|
597
|
+
Only the property inserted will displayed.
|
|
598
|
+
| Property |Type | Default | Description |
|
|
599
|
+
| ------------- | ------------- | ------------- |------------- |
|
|
600
|
+
| images | Array| [] | To display a carousel of images we need an array of objects, each object should include the src and the alt of each image |
|
|
601
|
+
| title |String| null | Display title underneath the images |
|
|
602
|
+
| description| String | null | Display description underneath the title |
|
|
603
|
+
| moreDetailsUrl | String | null | Display a button underneath the description to navigate to a provided URL |
|
|
604
|
+
| moreDetailsTitle | String | null| Set the title of the more details button |
|
|
605
|
+
|
|
606
|
+
example:
|
|
607
|
+
```js
|
|
608
|
+
const HOTSPOTS_CONFIG = [
|
|
609
|
+
{
|
|
610
|
+
positions,
|
|
611
|
+
variant: {
|
|
612
|
+
images: [
|
|
613
|
+
{ src: 'https://scaleflex.cloudimg.io/v7/demo/360-assets/AIR_SNORKEL_FINAL_JPG.png?vh=88bccb', alt: 'air snorkel' }
|
|
614
|
+
], // optional
|
|
615
|
+
title: 'Air Intake Snorkel', // optional
|
|
616
|
+
description: 'The snorkel gives the Gurkha an unmatched water-wading ability and ensures ample supply of fresh air for combustion.', // optional
|
|
617
|
+
moreDetailsUrl: 'https://forcegurkha.co.in', // optional
|
|
618
|
+
moreDetailsTitle: 'Read more' // optional
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
]
|
|
622
|
+
```
|
|
623
|
+
---
|
|
624
|
+
### Custom
|
|
625
|
+
Display any element in the DOM in a popup and link it with the hotspot.</br>
|
|
626
|
+
We will need to set the variant property value to the id of the element.
|
|
627
|
+
|
|
628
|
+
example:
|
|
629
|
+
```js
|
|
630
|
+
const HOTSPOTS_CONFIG = [
|
|
631
|
+
{
|
|
632
|
+
positions,
|
|
633
|
+
variant: 'gurkha-suv'
|
|
634
|
+
}
|
|
635
|
+
]
|
|
636
|
+
```
|
|
637
|
+
## PopupProps
|
|
638
|
+
Options to customize the hotspot popup.
|
|
639
|
+
### Properties
|
|
640
|
+
| Property | Type | Defaullt |Description |
|
|
641
|
+
| ------------- | ------------- | ------------- | ------------- |
|
|
642
|
+
| popupSelector |String| null |Set className to the popup wrapper |
|
|
643
|
+
| open |Boolean | false |Open the popup |
|
|
644
|
+
| arrow |Boolean| true |Dipslay an arrow that points toward the hotspot element|
|
|
645
|
+
| offset|Array | [0, 0] |Set a distance between the hotspot element and the popup |
|
|
646
|
+
| placement|String| Auto|- we can adjust the position of the hotspot popup relative to the hotspot element. (top - bottom - left - right)|
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
example:
|
|
650
|
+
```js
|
|
651
|
+
const HOTSPOTS_CONFIG = [
|
|
652
|
+
{
|
|
653
|
+
positions,
|
|
654
|
+
variant,
|
|
655
|
+
popupProps: {
|
|
656
|
+
popupSelector: 'air-intake-popup', // optional
|
|
657
|
+
offset: [20, 5], // optional
|
|
658
|
+
arrow: false, // optional
|
|
659
|
+
placement: 'bottom' // optional
|
|
660
|
+
},
|
|
661
|
+
indicatorSelector: 'first-hotspot-icon' // optional
|
|
662
|
+
}
|
|
663
|
+
]
|
|
664
|
+
```
|
|
665
|
+
## Responsive hotspots
|
|
666
|
+
Now we need to make our hotspots responsive to have an accurate positioning in different screens.
|
|
667
|
+
we have to set `initialDimensions` property to every hotspot config. which indicates the dimension of the cloudimage-360 view.<br/>
|
|
668
|
+
hint: `data-info` can be used to get view size.
|
|
669
|
+
|
|
670
|
+
example:
|
|
671
|
+
```js
|
|
672
|
+
const HOTSPOTS_CONFIG = [
|
|
673
|
+
{
|
|
674
|
+
positions,
|
|
675
|
+
variant,
|
|
676
|
+
popupProps,
|
|
677
|
+
indicatorSelector,
|
|
678
|
+
initialDimensions: [ 1170, 662 ]
|
|
679
|
+
}
|
|
680
|
+
]
|
|
681
|
+
```
|
|
682
|
+
## Add Hotspots
|
|
683
|
+
we need this function to link the created config with the 360-view.
|
|
684
|
+
```js
|
|
685
|
+
window.CI360.addHotspots(idOftheView, hotspotsConfig);
|
|
686
|
+
```
|
|
687
|
+
example:
|
|
688
|
+
```js
|
|
689
|
+
window.CI360.addHotspots("gurkha-suv", HOTSPOTS_CONFIG);
|
|
690
|
+
```
|
|
691
|
+
<a href="https://codesandbox.io/s/competent-bogdan-49b0u6?file=/index.html"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="edit in codesandbox"/></a>
|
|
692
|
+
|
|
693
|
+
### data-responsive (or responsive)
|
|
694
|
+
|
|
695
|
+
###### Type: **String** (Cloudimage token) | Default: **none** | _required for cloudimage responsive plugin_
|
|
696
|
+
|
|
697
|
+
Enables cloudimage responsive plugin for 360 view.
|
|
442
698
|
|
|
443
699
|
## <a name="cloudimage-responsive-integration"/> Cloudimage Responsive Integration
|
|
444
700
|
|
|
@@ -497,27 +753,6 @@ Lazy loading is not included into js-cloudimage-360-view by default. There are w
|
|
|
497
753
|
|
|
498
754
|
[Implementation example with lozad.js](https://codesandbox.io/s/0185934m8p?fontsize=14)
|
|
499
755
|
|
|
500
|
-
to save API calls you man want to use one of our cdn bundles:
|
|
501
|
-
|
|
502
|
-
CDN link to js-cloudimage-360-view 1.1.0 + lazysizes 4.1.7
|
|
503
|
-
|
|
504
|
-
```javascript
|
|
505
|
-
<script src="https://cdn.scaleflex.it/filerobot/js-cloudimage-360-view/v2.0.0.lazysizes.min.js"></script>
|
|
506
|
-
```
|
|
507
|
-
|
|
508
|
-
CDN link to js-cloudimage-360-view 1.1.0 + yall.js 3.1.1
|
|
509
|
-
|
|
510
|
-
```javascript
|
|
511
|
-
<script src="https://cdn.scaleflex.it/filerobot/js-cloudimage-360-view/v2.0.0.yall.min.js"></script>
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
CDN link to js-cloudimage-360-view 1.1.0 + lozad.js 1.9.0
|
|
515
|
-
|
|
516
|
-
```javascript
|
|
517
|
-
<script src="https://cdn.scaleflex.it/filerobot/js-cloudimage-360-view/v2.0.0.lozad.min.js"></script>
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
|
|
521
756
|
## <a name="best-practices"/> Best practices
|
|
522
757
|
|
|
523
758
|
* In order to use cloudimage responsive with 360 view, your original (master) images should be stored on a server
|
|
@@ -543,5 +778,4 @@ Tested in all modern browsers and IE 11, 10, 9.
|
|
|
543
778
|
All contributions are super welcome!
|
|
544
779
|
|
|
545
780
|
## <a name="license"></a>License
|
|
546
|
-
JS Cloudimage 360 View is provided under the [MIT License](https://opensource.org/licenses/MIT)
|
|
547
|
-
|
|
781
|
+
JS Cloudimage 360 View is provided under the [MIT License](https://opensource.org/licenses/MIT)
|