mirror of
https://github.com/webslides/WebSlides.git
synced 2025-08-18 19:02:00 +02:00
Adding some transitioning to zoom
This commit is contained in:
@@ -133,9 +133,7 @@ export default class Zoom {
|
||||
*/
|
||||
zoomIn() {
|
||||
DOM.show(this.zws_.el);
|
||||
const currentId = this.ws_.el
|
||||
.querySelector(`.${CLASSES.SLIDE}.${CLASSES.CURRENT}`)
|
||||
.getAttribute('id');
|
||||
const currentId = this.ws_.currentSlide_.el.id;
|
||||
const zoomedCurrent = this.zws_.el
|
||||
.querySelector(`.${CLASSES.WRAP}.${CLASSES.CURRENT}`);
|
||||
if (zoomedCurrent) {
|
||||
@@ -145,22 +143,26 @@ export default class Zoom {
|
||||
.querySelector(`#zoomed-${currentId}`)
|
||||
.classList.add(CLASSES.CURRENT);
|
||||
|
||||
setTimeout(() => {
|
||||
this.ws_.disable();
|
||||
}, 400);
|
||||
this.isZoomed_ = true;
|
||||
document.body.style.overflow = 'auto';
|
||||
|
||||
setTimeout(() => {
|
||||
this.ws_.disable();
|
||||
this.zws_.el.classList.add('in');
|
||||
}, 50);
|
||||
}
|
||||
|
||||
/**
|
||||
* Zoom Out the slider, remove scale from the slides.
|
||||
*/
|
||||
zoomOut() {
|
||||
this.zws_.el.classList.remove('in');
|
||||
|
||||
setTimeout(() => {
|
||||
DOM.hide(this.zws_.el);
|
||||
this.ws_.enable();
|
||||
}, 400);
|
||||
DOM.hide(this.zws_.el);
|
||||
this.isZoomed_ = false;
|
||||
document.body.style.overflow = '';
|
||||
}, 400);
|
||||
}
|
||||
}
|
||||
|
@@ -95,6 +95,20 @@
|
||||
transform: scale(.5) translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
& .column {
|
||||
opacity: 0;
|
||||
transform: scale(1.2);
|
||||
transition: opacity .4s, transform .4s;
|
||||
transition-delay: .2s;
|
||||
}
|
||||
|
||||
&.in {
|
||||
.column {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.text-slide-number {
|
||||
@@ -104,6 +118,8 @@
|
||||
}
|
||||
|
||||
#webslides {
|
||||
transition: filter .3s;
|
||||
|
||||
&.disabled,
|
||||
&.zooming {
|
||||
position: fixed;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* Name: WebSlides
|
||||
* Version: 1.3.1
|
||||
* Date: 2017-06-27
|
||||
* Date: 2017-06-28
|
||||
* Description: Making HTML presentations easy
|
||||
* URL: https://github.com/webslides/webslides#readme
|
||||
* Credits: @jlantunez, @LuisSacristan, @Belelros
|
||||
@@ -46,8 +46,8 @@
|
||||
14. Forms
|
||||
15. Longform Elements
|
||||
16. Safari Bug (flex-wrap)
|
||||
17. Print
|
||||
18. Slidex index (aka zoom)
|
||||
17. Slidex index (aka zoom)
|
||||
18. Print
|
||||
19. Colors
|
||||
----------------------------------------------------------------------------------- */
|
||||
/*
|
||||
@@ -2865,44 +2865,6 @@ Solution: stackoverflow.com/questions/34250282/flexbox-safari-bug-flex-wrap
|
||||
.cta:after {
|
||||
width: 0; }
|
||||
|
||||
/*=========================================
|
||||
17. PRINT
|
||||
=========================================== */
|
||||
@media print {
|
||||
@page {
|
||||
margin: .5cm;
|
||||
size: A4 landscape; }
|
||||
* {
|
||||
background: transparent !important;
|
||||
color: #000 !important;
|
||||
-webkit-filter: none !important;
|
||||
filter: none !important;
|
||||
text-shadow: none !important; }
|
||||
html,
|
||||
body,
|
||||
#webslides {
|
||||
height: auto !important;
|
||||
overflow: auto !important;
|
||||
width: auto !important; }
|
||||
#webslides {
|
||||
overflow-x: auto !important;
|
||||
overflow-y: auto !important; }
|
||||
section,
|
||||
.slide {
|
||||
display: -webkit-box !important;
|
||||
display: -ms-flexbox !important;
|
||||
display: flex !important;
|
||||
height: auto !important; }
|
||||
section * {
|
||||
-webkit-animation: none;
|
||||
animation: none; }
|
||||
table,
|
||||
figure {
|
||||
page-break-inside: avoid; }
|
||||
#counter,
|
||||
#navigation {
|
||||
display: none; } }
|
||||
|
||||
/*==============================================
|
||||
18. Slides Index: Thumbnails navigation gallery
|
||||
================================================ */
|
||||
@@ -2996,21 +2958,77 @@ Solution: stackoverflow.com/questions/34250282/flexbox-safari-bug-flex-wrap
|
||||
#webslides-zoomed .column > .wrap-zoom > .slide {
|
||||
-webkit-transform: scale(0.5) translate(-50%, -50%);
|
||||
transform: scale(0.5) translate(-50%, -50%); } }
|
||||
#webslides-zoomed .column {
|
||||
opacity: 0;
|
||||
-webkit-transform: scale(1.2);
|
||||
transform: scale(1.2);
|
||||
-webkit-transition: opacity .4s, -webkit-transform .4s;
|
||||
transition: opacity .4s, -webkit-transform .4s;
|
||||
transition: opacity .4s, transform .4s;
|
||||
transition: opacity .4s, transform .4s, -webkit-transform .4s;
|
||||
-webkit-transition-delay: .2s;
|
||||
transition-delay: .2s; }
|
||||
#webslides-zoomed.in .column {
|
||||
opacity: 1;
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1); }
|
||||
|
||||
.text-slide-number {
|
||||
display: inline-block;
|
||||
margin: .8rem auto;
|
||||
text-align: center; }
|
||||
|
||||
#webslides {
|
||||
-webkit-transition: -webkit-filter .3s;
|
||||
transition: -webkit-filter .3s;
|
||||
transition: filter .3s;
|
||||
transition: filter .3s, -webkit-filter .3s; }
|
||||
#webslides.disabled, #webslides.zooming {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 0; }
|
||||
|
||||
#webslides.disabled {
|
||||
-webkit-filter: blur(10px);
|
||||
filter: blur(10px); }
|
||||
|
||||
/*=========================================
|
||||
17. PRINT
|
||||
=========================================== */
|
||||
@media print {
|
||||
@page {
|
||||
margin: .5cm;
|
||||
size: A4 landscape; }
|
||||
* {
|
||||
background: transparent !important;
|
||||
color: #000 !important;
|
||||
-webkit-filter: none !important;
|
||||
filter: none !important;
|
||||
text-shadow: none !important; }
|
||||
html,
|
||||
body,
|
||||
#webslides {
|
||||
height: auto !important;
|
||||
overflow: auto !important;
|
||||
width: auto !important; }
|
||||
#webslides {
|
||||
overflow-x: auto !important;
|
||||
overflow-y: auto !important; }
|
||||
section,
|
||||
.slide {
|
||||
display: -webkit-box !important;
|
||||
display: -ms-flexbox !important;
|
||||
display: flex !important;
|
||||
height: auto !important; }
|
||||
section * {
|
||||
-webkit-animation: none;
|
||||
animation: none; }
|
||||
table,
|
||||
figure {
|
||||
page-break-inside: avoid; }
|
||||
#counter,
|
||||
#navigation {
|
||||
display: none; } }
|
||||
|
||||
/*=========================================
|
||||
19. Colors
|
||||
=========================================== */
|
||||
@@ -3273,7 +3291,8 @@ nav[role='navigation'] li.active a {
|
||||
color: #fff; }
|
||||
|
||||
nav[role='navigation'] li a {
|
||||
background-color: rgba(50, 50, 50, 0.9); }
|
||||
background-color: rgba(50, 50, 50, 0.9);
|
||||
color: #fff; }
|
||||
nav[role='navigation'] li a:hover {
|
||||
background-color: rgba(50, 50, 50, 0.7); }
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* Name: WebSlides
|
||||
* Version: 1.3.1
|
||||
* Date: 2017-06-27
|
||||
* Date: 2017-06-28
|
||||
* Description: Making HTML presentations easy
|
||||
* URL: https://github.com/webslides/webslides#readme
|
||||
* Credits: @jlantunez, @LuisSacristan, @Belelros
|
||||
@@ -1152,6 +1152,10 @@ var WebSlides = function () {
|
||||
key: 'disable',
|
||||
value: function disable() {
|
||||
this.el.classList.add(CLASSES.DISABLED);
|
||||
|
||||
if (this.plugins.autoslide && this.plugins.autoslide.time !== false) {
|
||||
this.plugins.autoslide.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1162,6 +1166,10 @@ var WebSlides = function () {
|
||||
key: 'enable',
|
||||
value: function enable() {
|
||||
this.el.classList.remove(CLASSES.DISABLED);
|
||||
|
||||
if (this.plugins.autoslide && this.plugins.autoslide.time !== false) {
|
||||
this.plugins.autoslide.play();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2769,9 +2777,13 @@ var Zoom = function () {
|
||||
_createClass(Zoom, [{
|
||||
key: 'onKeyDown',
|
||||
value: function onKeyDown(event) {
|
||||
if (!this.isZoomed_ && __WEBPACK_IMPORTED_MODULE_1__utils_keys__["a" /* default */].MINUS.includes(event.which)) {
|
||||
if (!this.isZoomed_ && __WEBPACK_IMPORTED_MODULE_1__utils_keys__["a" /* default */].MINUS.some(function (key) {
|
||||
return key === event.which;
|
||||
})) {
|
||||
this.zoomIn();
|
||||
} else if (this.isZoomed_ && (__WEBPACK_IMPORTED_MODULE_1__utils_keys__["a" /* default */].PLUS.includes(event.which) || event.which === __WEBPACK_IMPORTED_MODULE_1__utils_keys__["a" /* default */].ESCAPE)) {
|
||||
} else if (this.isZoomed_ && (__WEBPACK_IMPORTED_MODULE_1__utils_keys__["a" /* default */].PLUS.some(function (key) {
|
||||
return key === event.which;
|
||||
}) || event.which === __WEBPACK_IMPORTED_MODULE_1__utils_keys__["a" /* default */].ESCAPE)) {
|
||||
this.zoomOut();
|
||||
}
|
||||
}
|
||||
@@ -2872,17 +2884,20 @@ var Zoom = function () {
|
||||
var _this3 = this;
|
||||
|
||||
__WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].show(this.zws_.el);
|
||||
var currentId = this.ws_.el.querySelector('.' + CLASSES.SLIDE + '.' + CLASSES.CURRENT).getAttribute('id');
|
||||
var currentId = this.ws_.currentSlide_.el.id;
|
||||
var zoomedCurrent = this.zws_.el.querySelector('.' + CLASSES.WRAP + '.' + CLASSES.CURRENT);
|
||||
if (zoomedCurrent) {
|
||||
zoomedCurrent.classList.remove(CLASSES.CURRENT);
|
||||
}
|
||||
this.zws_.el.querySelector('#zoomed-' + currentId).classList.add(CLASSES.CURRENT);
|
||||
setTimeout(function () {
|
||||
_this3.ws_.disable();
|
||||
}, 400);
|
||||
|
||||
this.isZoomed_ = true;
|
||||
document.body.style.overflow = 'auto';
|
||||
|
||||
setTimeout(function () {
|
||||
_this3.ws_.disable();
|
||||
_this3.zws_.el.classList.add('in');
|
||||
}, 50);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2894,12 +2909,14 @@ var Zoom = function () {
|
||||
value: function zoomOut() {
|
||||
var _this4 = this;
|
||||
|
||||
this.zws_.el.classList.remove('in');
|
||||
|
||||
setTimeout(function () {
|
||||
__WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].hide(_this4.zws_.el);
|
||||
_this4.ws_.enable();
|
||||
}, 400);
|
||||
this.isZoomed_ = false;
|
||||
__WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].hide(_this4.zws_.el);
|
||||
_this4.isZoomed_ = false;
|
||||
document.body.style.overflow = '';
|
||||
}, 400);
|
||||
}
|
||||
}]);
|
||||
|
||||
|
4
static/js/webslides.min.js
vendored
4
static/js/webslides.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user