Skip to content

Commit

Permalink
update demo to make it more responsible for mobile devices;
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-stramavus committed Apr 17, 2019
1 parent 7c1e9d8 commit ea5d79c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ <h2>Engage your customers with a stunning <strong>360 view of your products</str
<!--</div>-->
<section class="main-360-spin">
<div
id="mercedes-360-view"
class="cloudimage-360"
data-folder="https://scaleflex.cloudimg.io/crop/1920x700/n/https://scaleflex.airstore.io/demo/360-car/"
data-filename="iris-{index}.jpeg"
Expand All @@ -114,7 +115,7 @@ <h2>Engage your customers with a stunning <strong>360 view of your products</str
data-responsive="demo"
data-spin-reverse
></div>
<p class="view-360-capture">36 images, autoplay, bottom 360 view circle, arrow keys support, inner box shadow</p>
<p class="view-360-capture">36 images, autoplay (desktop only), bottom 360 view circle, arrow keys support (desktop only), magnifier (desktop only), inner box shadow</p>
</section>

<section class="container ready-to-start">
Expand Down Expand Up @@ -179,7 +180,7 @@ <h2 class="text-center">More examples</h2>
data-responsive="demo"
></div>
</div>
<p class="view-360-capture">36 images, magnifier</p>
<p class="view-360-capture">36 images, magnifier (desktop only)</p>
</div>
</div>

Expand Down Expand Up @@ -215,7 +216,7 @@ <h2 class="text-center">More examples</h2>
</div>
<p class="view-360-capture">36 images, bottom 360 view circle, box-shadow</p>
</div>
<div class="row" style="margin-top: 40px;">
<div class="row no-mobile" style="margin-top: 40px;">
<div class="col-md-4">
<div style="max-width: 1000px;">
<div
Expand Down
1 change: 1 addition & 0 deletions examples/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './mobile.init';
import '../../src';
import './style.css';
import './assets/fonts/helvetica-neue.css';
Expand Down
22 changes: 22 additions & 0 deletions examples/src/mobile.init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import MobileDetect from 'mobile-detect';


const md = new MobileDetect(window.navigator.userAgent);
const isMobile = md.mobile();

if (isMobile) {
const elementsToHide = document.querySelectorAll('.no-mobile');
const mercedes360View = document.getElementById('mercedes-360-view');

for (let i = 0; elementsToHide.length > i; i++ ) {
const elem = elementsToHide[i];
elem.parentNode.removeChild(elem);
}

mercedes360View.setAttribute(
'data-folder',
'https://scaleflex.cloudimg.io/crop/600x400/n/https://scaleflex.airstore.io/demo/360-car/'
);
mercedes360View.setAttribute('data-ratio', '0.666');
mercedes360View.setAttribute('data-bottom-circle-offset', '22');
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"gh-pages": "^2.0.1",
"highlight.js": "^9.15.6",
"html-webpack-plugin": "^3.2.0",
"mobile-detect": "^1.4.3",
"style-loader": "^0.23.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0",
Expand Down

0 comments on commit ea5d79c

Please sign in to comment.