1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-09-02 09:33:25 +02:00

Adding new showIndex option to WebSlides class

This commit is contained in:
Luis Sacristán
2017-08-02 21:41:46 +02:00
parent 94e8e22f10
commit f4c93e68d3
4 changed files with 155 additions and 143 deletions

View File

@@ -44,6 +44,7 @@ export default class WebSlides {
* navigation can occur again with scroll.
* @param {number} slideOffset Controls the amount of needed touch delta to
* trigger navigation.
* @param {boolean} showIndex Controls if the index can be shown.
*/
constructor({
autoslide = false,
@@ -52,7 +53,8 @@ export default class WebSlides {
minWheelDelta = 40,
navigateOnScroll = true,
scrollWait = 450,
slideOffset = 50
slideOffset = 50,
showIndex = true
} = {}) {
/**
* WebSlide element.
@@ -113,7 +115,8 @@ export default class WebSlides {
minWheelDelta,
navigateOnScroll,
scrollWait,
slideOffset
slideOffset,
showIndex
};
/**
* Initialisation flag.
@@ -393,7 +396,9 @@ export default class WebSlides {
* Toggles zoom
*/
toggleZoom() {
this.plugins.zoom.toggleZoom();
if (this.options.showIndex) {
this.plugins.zoom.toggleZoom();
}
}
/**

View File

@@ -137,6 +137,7 @@ export default class Zoom {
* Zoom In the slider, scales the slides and uses a grid layout to show them.
*/
zoomIn() {
if (!this.ws_.options.showIndex) return;
this.enable();
const currentId = this.ws_.currentSlide_.el.id;
const zoomedCurrent = this.zws_.el
@@ -168,6 +169,7 @@ export default class Zoom {
* Zoom Out the slider, remove scale from the slides.
*/
zoomOut() {
if (!this.ws_.options.showIndex) return;
this.zws_.el.classList.remove('in');
setTimeout(() => {