Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-cloudimage-360-view

Package Overview
Dependencies
Maintainers
3
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-cloudimage-360-view

[![Release](https://img.shields.io/badge/release-v2.7.6-blue.svg)](https://github.com/scaleflex/js-cloudimage-360-view/releases) [![Contributions welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)](#contributing) [![License](https:/

  • 2.7.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
731
decreased by-18.78%
Maintainers
3
Weekly downloads
 
Created
Source

Release Contributions welcome License Scaleflex team

Tweet

The Lounge

JS Cloudimage 360 View

DocsDemoCode SandboxVideo TutorialWhy

A simple, interactive resource that can be used to provide a virtual tour of your product.

The Lounge

powered by Cloudimage (Watch the video here)

Table of contents

Demo

To see the Cloudimage 360 view plugin in action, please check out the Demo page.

Step 1: Installation

Add script tag with CDN link to js-cloudimage-360-view lib after all content in body tag

<script src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/2.7.5/js-cloudimage-360-view.min.js"></script>

Step 2: Initialize

After adding the js-cloudimage-360-view lib, simply initialize it with class name "cloudimage-360", server folder path, file name and amount of images:

<div
   class="cloudimage-360"
   data-folder="https://scaleflex.airstore.io/demo/360-car/"
   data-filename-x="iris-{index}.jpeg"
   data-amount-x="36"
></div>

edit in codesandbox

Methods

init

Type: Function

Initialization of js cloudimage 360 view plugin.

window.CI360.init();

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

<script>window.CI360 = { notInitOnLoad: true }</script>
<script src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/2/js-cloudimage-360-view.min.js"></script>
<script>window.CI360.init(); // initialize the plugin when you need</script>

update

Type: Function
window.CI360.update(idOfInstance, forceUpdate);

Update cloudimage 360 viewer instance.
For any update in source attributes after plugin initialization (e.g. data-folder, data-filename-x, data-amount-y), the plugin will re-init.

Properties

idOfInstance: string

The id of the instance

<div
   id="cloudimage-360-car"
   class="cloudimage-360"
   data-folder="https://scaleflex.airstore.io/demo/360-car/"
   data-filename-x="iris-{index}.jpeg"
   data-amount-x="36"
></div>
window.CI360.update('cloudimage-360-car');
forceUpdate: bool

Force the plugin to re-init.

window.CI360.update(null, true);

destroy

Type: Function

Destroying a cloudimage 360 viewer instance will reset the HTML to its original state.

window.CI360.destroy();
edit in codesandbox

getActiveIndexByID

Type: Function

Get the {index} of the image that is being viewed.

window.CI360.getActiveIndexByID(idOfInstance: string, oriantation: string);

Properties

idOfInstance: string

The id of the instance

oriantation: string

The oriantation of the active index

Customize elements

You can customize elements by adding the following classes:

Example CSS

.cloudimage-360-icons-container {
	top: 5px;
  	right: 5px;
}
.cloudimage-360-fullscreen-modal {
	top: 0;
  	bottom: 0;
}
.cloudimage-360-magnifier-icon {
	background: url(https://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/loupe.svg) 50% 50% / cover no-repeat;
}
.cloudimage-360-close-fullscreen-icon {
	background: url(https://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/cross.svg) 50% 50% / cover no-repeat;
}
.cloudimage-360-view-360-circle {
  	margin: auto;
}
.cloudimage-360-loader {
	margin: auto;
}
.cloudimage-360-view-360-icon {
	background: url(hhttps://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/360_view.svg) 50% 50% / cover no-repeat;
}
.cloudimage-360-box-shadow {
	top: 0;
  	left: 0;
}
.cloudimage-360-img-magnifier-glass {
	border: 3px solid #000;
  	border-radius: 50%;
}

Config

class

Type: String | Value: "cloudimage-360" | required

The selector for js-cloudimage-360-view lib.

data-folder (or folder)

Type: String(url) | required

Your images folder on server.

data-api-version (or api-version)

Type: String |Default: 'v7' | optional

Allow to use a specific version of API.

  • set a specific version of API
data-api-version="v7"
  • disable API version
data-api-version="null"

data-filename (or filename)

data-filename-x (or filename-x)

data-filename (or filename) [deprecated]

Type: String | Default: image-{index}.jpg | optional

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-filename-y (or filename-y)

Type: String | Default: image-y-{index}.jpg | optional

The filename pattern for y-oriantation images. Must include {index}, which the library will replace with a number between 1 and data-amount-y.

data-amount-x (or amount-x)

data-amount (or amount-x) [deprecated]

Type: Number | Default: 36 | optional

Amount of images to load for 360 view.

data-amount-y (or amount-y)

Type: Number | Default: 0 | optional

Amount of images to load in Y-axis for 360 view.

data-keys (or keys)

Type: Bool | Default: false | optional

Support for 360 spin by pressing arrow keys on keyboard.

data-keys-reverse (or keys-reverse)

Type: Bool | Default: false | optional

invert arrow keys on keyboard.

data-autoplay (or autoplay)

Type: Bool | Default: false | optional

Autoplay 360 spin view on load.

data-play-once (or autoplay)

Type: Bool | Default: false | optional

stops the autoplay after one complete cycle.

data-autoplay-behavior (or autoplay-behavior)

Type: String | Default: spin-x | optional

Changing autoplay behavior

Available behaviors (spin-x, spin-y, spin-xy, spin-yx)

data-fullscreen (or fullscreen)

data-full-screen (or full-screen) [deprecated]

Type: Bool | Default: false | optional

Open 360 spin view in full screen modal.

data-magnifier (or magnifier)

Type: Number | Default: none | optional

Magnifier to zoom image.

data-ratio (or ratio)

Type: Number (width / height) or JSON object | Default: none | optional
ratio: string

Setting the height relative to the container width according to the provided ratio
In the following example, the height should be 0.3 the container width

<div
	id="cloudimage-360-car"
	class="cloudimage-360"
	data-folder="https://scaleflex.airstore.io/demo/360-car/"
	data-filename-x="iris-{index}.jpeg"
	data-amount-x="36"
	data-ratio="2"
></div>

edit in codesandbox

ratio: JSON

Setting the height relative to the container width at any window size.

In the following example, the height should be 1.3 the container width at window size less than or equal to 567px and 2.22 at window size less than or equal to 768px.

<div
	id="cloudimage-360-car"
	class="cloudimage-360"
	data-folder="https://scaleflex.airstore.io/demo/360-car/"
	data-filename-x="iris-{index}.jpeg"
	data-amount-x="36"
	data-ratio='{
		"576": "1.3",
		"768": "2.22",
		"992": "2.23",
		"1200": "3",
		"2400": "3.2"
	}'
></div>

edit in codesandbox

data-autoplay-reverse (or autoplay-reverse)

Type: Bool | Default: false | optional

Autoplay 360 spin view on load.

data-disable-drag (or disable-drag)

Type: bool | Default: false | optional

disable mouse drag.

data-speed (or speed)

Type: Number | Default: 150 | optional

Speed of changing frames for autoplay in milliseconds.

data-drag-speed (or drag-speed)

Type: Number | Default: 150 | optional

Speed Factor of changing frames on drag event.

data-spin-reverse (or spin-reverse)

Type: Bool | Default: false | optional

Spin direction, by default it uses counterclockwise (image indexes from 1 to data-amount-x).

data-box-shadow (or box-shadow)

Type: String (e.g. data-box-shadow="inset 0 0 100px #222") | Default: none | optional

Apply box shadow for container.

data-bottom-circle (or bottom-circle)

Type: Bool | Default: false | optional

Display 360 view line at the bottom of container.

Type: Bool | Default: false | optional

Hide 360 view icon.

data-logo-src (or logo-src) [deprecated]

Type: String | Default: https://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/360_view.svg | optional

URL of asset to use as the 360 view icon.

kindly read Customize elements

data-control-reverse (or control-reverse)

Type: Bool | Default: false | optional

Spin direction using controls, by default it uses counterclockwise (image indexes from 1 to data-amount-x).

data-stop-at-edges (or stop-at-edges)

Type: Bool | Default: false | optional

Blocks repeating images after reaching last image (or first image in opposite direction)

data-bottom-circle-offset (or bottom-circle-offset)

Type: Number | Default: 5 | optional

Bottom offset for 360 view line.

data-index-zero-base (or index-zero-base)

Type: Number | optional

Left zero padding on filename. For example: index-zero-base="4" => image index will be "0004"

data-image-list-x (or data-image-list-x)

data-image-list (or image-list) [deprecated]

Type: Array | optional

Option to add list of images in x-oriantation instead of folder , filename-x & amount-x.

example:

data-folder="https://scaleflex.airstore.io/demo/360-car/"
data-image-list-x='[
   "iris-1.jpeg",
   "iris-4.jpeg",
   "https://scaleflex.airstore.io/demo/360-car/iris-12.jpeg",
   "https://scaleflex.airstore.io/demo/360-car/iris-15.jpeg"
   ]’

data-image-list-y (or data-image-list-y)

Type: Array | optional

Option to add list of images in y-oriantation instead of folder , filename-y & amount-y.

example:

data-folder="https://scaleflex.airstore.io/demo/360-car/"
data-image-list-y='[
   "iris-2-y.jpeg",
   "iris-6-y.jpeg",
   "https://scaleflex.airstore.io/demo/360-car/iris-8-y.jpeg",
   "https://scaleflex.airstore.io/demo/360-car/iris-30-y.jpeg"
   ]’

data-pointer-zoom (or pointer-zoom)

Type: Number | Default: none | optional

Pointer zoom scale

example:

data-pointer-zoom="3"

when mouse clicked the image scale will be multiplied by 3.

data-lazyload (or lazyload)

Type: Bool | Default: false | optional

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

data-lazyload-selector (or lazyload-selector)

Type: String | Default: lazyload | optional

Helper class to apply lazy-loading depending on library you choose, see Lazy loading

Controls

You can add controls by adding elements with the following classes: cloudimage-360-left, cloudimage-360-right, cloudimage-360-top, cloudimage-360-bottom , ~~cloudimage-360-prev**, cloudimage-360-next~~ [deprecated]

Example CSS

.cloudimage-360 .cloudimage-360-left, .cloudimage-360 .cloudimage-360-right {
	padding: 8px;
	background: rgba(255, 255, 255, 0.5);
	border: none;
	border-radius: 4px;
}
.cloudimage-360 .cloudimage-360-left:focus, .cloudimage-360 .cloudimage-360-right:focus {
	outline: none;
}
.cloudimage-360 .cloudimage-360-left {
	display: none;
	position: absolute;
	z-index: 100;
	top: calc(50% - 15px);
	left: 20px;
}
.cloudimage-360 .cloudimage-360-right {
	display: none;
	position: absolute;
	z-index: 100;
	top: calc(50% - 15px);
	right: 20px;
}
.cloudimage-360 .cloudimage-360-left:before, .cloudimage-360 .cloudimage-360-right:before {
	content: '';
	display: block;
	width: 30px;
	height: 30px;
	background: 50% 50% / cover no-repeat;
}
.cloudimage-360 .cloudimage-360-left:before {
	background-image: url('https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/assets/img/arrow-left.svg');
}
.cloudimage-360 .cloudimage-360-right:before {
	background-image: url('https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/assets/img/arrow-right.svg');
}
.cloudimage-360 .cloudimage-360-left.not-active, .cloudimage-360 .cloudimage-360-right.not-active {
	opacity: 0.4;
	cursor: default;
}

Example HTML

<div
	class="cloudimage-360"
	data-folder="https://scaleflex.airstore.io/demo/indoor/"
	data-filename-x="{index}.jpeg"
>
	<button class="cloudimage-360-left"></button>
	<button class="cloudimage-360-right"></button>
	<button class="cloudimage-360-top"></button>
	<button class="cloudimage-360-bottom"></button>
</div>

edit in codesandbox

Cloudimage Responsive Integration

See how it works (article on Medium)

Requirements

To use the Cloudimage Responsive plugin, you will need a Cloudimage token to deliver your images over CDN. Don't worry, it only takes seconds to get one by registering here. Once your token is created, you can configure it as described below. This token allows you to use 25GB of image cache and 25GB of worldwide CDN traffic per month for free.

data-responsive (or responsive)

Type: String (Cloudimage token) | Default: none | required for cloudimage responsive plugin

Enables cloudimage responsive plugin for 360 view.

data-transformation (or transformation)

Type: String | Default: none | optional

Applies Cloudimage resize operations to your image, e.g. width, height, crop, face crop, rotate, prevent enlargement... Multiple transformation operations can be applied to your image, separated by "&" (Ampersand). example:

data-transformation="w=400&h=200&func=fit"

Full documentation here.

data-filters (or filters)

Type: String | Default: none | optional

Applies Cloudimage filters to your image, e.g. brightness, contrast, greyscale, blur, Sharpen... Multiple filters can be applied, separated by "," (comma). example:

data-filters="bright:15,contrast:30"

Full documentation here.

Lazy Loading

Lazy loading is not included into js-cloudimage-360-view by default. There are well thought libraries to achieve that. If you enable lazy loading in the configuration, you need to add an additional library like lazysizes, yall.js (Yet Another Lazy Loader), lozad.js to handle it.

Implementation example with lazysizes

Implementation example with yall.js

Implementation example with lozad.js

to save API calls you man want to use one of our cdn bundles:

CDN link to js-cloudimage-360-view 1.1.0 + lazysizes 4.1.7

<script src="https://cdn.scaleflex.it/filerobot/js-cloudimage-360-view/v2.0.0.lazysizes.min.js"></script>

CDN link to js-cloudimage-360-view 1.1.0 + yall.js 3.1.1

<script src="https://cdn.scaleflex.it/filerobot/js-cloudimage-360-view/v2.0.0.yall.min.js"></script>

CDN link to js-cloudimage-360-view 1.1.0 + lozad.js 1.9.0

<script src="https://cdn.scaleflex.it/filerobot/js-cloudimage-360-view/v2.0.0.lozad.min.js"></script>

Best practices

Browser support

Tested in all modern browsers and IE 11, 10, 9.

Filerobot UI Familiy

Contributing!

All contributions are super welcome!

License

JS Cloudimage 360 View is provided under the MIT License

Keywords

FAQs

Package last updated on 20 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc