mirror of
https://github.com/edward-shen/MMM-pages.git
synced 2024-11-24 03:04:29 -08:00
partial work
This commit is contained in:
parent
67d142452d
commit
e1e185ceed
2 changed files with 54 additions and 22 deletions
65
MMM-pages.js
65
MMM-pages.js
|
@ -14,7 +14,8 @@ Module.register('MMM-pages', {
|
||||||
fixed: ['MMM-page-indicator'],
|
fixed: ['MMM-page-indicator'],
|
||||||
animationTime: 1000,
|
animationTime: 1000,
|
||||||
rotationTime: 0,
|
rotationTime: 0,
|
||||||
rotationDelay: 10000
|
rotationDelay: 10000,
|
||||||
|
slideAnimation: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,27 +145,57 @@ Module.register('MMM-pages', {
|
||||||
animatePageChange: function() {
|
animatePageChange: function() {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
// Hides all modules not on the current page. This hides any module not
|
if (this.config.slideAnimation) {
|
||||||
// meant to be shown.
|
MM.getModules()
|
||||||
MM.getModules()
|
.exceptWithClass(this.config.fixed)
|
||||||
.exceptWithClass(this.config.fixed)
|
.exceptWithClass(this.config.modules[this.curPage])
|
||||||
.exceptWithClass(this.config.modules[this.curPage])
|
.enumerate(module => {
|
||||||
.enumerate(module => module.hide(
|
const element = document.getElementById(module.data.identifier);
|
||||||
self.config.animationTime / 2,
|
if (element) {
|
||||||
{ lockString: self.identifier }
|
element.classList.add("mmm-pages-slide-out");
|
||||||
));
|
element.classList.remove("mmm-pages-slide-in");
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
module.hide(0, { lockString: self.identifier });
|
||||||
|
if (element) {
|
||||||
|
element.classList.remove("mmm-pages-slide-out");
|
||||||
|
}
|
||||||
|
}, self.config.animationTime);
|
||||||
|
});
|
||||||
|
|
||||||
// Shows all modules meant to be on the current page, after a small delay.
|
|
||||||
setTimeout(() => {
|
|
||||||
MM.getModules()
|
MM.getModules()
|
||||||
.withClass(self.config.modules[self.curPage])
|
.withClass(self.config.modules[self.curPage])
|
||||||
.enumerate((module) => {
|
.enumerate((module) => {
|
||||||
module.show(
|
const element = document.getElementById(module.data.identifier);
|
||||||
self.config.animationTime / 2,
|
if (element) {
|
||||||
{ lockString: self.identifier }
|
element.classList.add("mmm-pages-slide-in");
|
||||||
);
|
}
|
||||||
|
module.show(0, { lockString: self.identifier } );
|
||||||
});
|
});
|
||||||
}, this.config.animationTime / 2);
|
|
||||||
|
} else {
|
||||||
|
// Hides all modules not on the current page. This hides any module not
|
||||||
|
// meant to be shown.
|
||||||
|
MM.getModules()
|
||||||
|
.exceptWithClass(this.config.fixed)
|
||||||
|
.exceptWithClass(this.config.modules[this.curPage])
|
||||||
|
.enumerate(module => module.hide(
|
||||||
|
self.config.animationTime / 2,
|
||||||
|
{ lockString: self.identifier }
|
||||||
|
));
|
||||||
|
|
||||||
|
// Shows all modules meant to be on the current page, after a small delay.
|
||||||
|
setTimeout(() => {
|
||||||
|
MM.getModules()
|
||||||
|
.withClass(self.config.modules[self.curPage])
|
||||||
|
.enumerate((module) => {
|
||||||
|
module.show(
|
||||||
|
self.config.animationTime / 2,
|
||||||
|
{ lockString: self.identifier }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}, this.config.animationTime / 2);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
11
pages.css
11
pages.css
|
@ -1,5 +1,6 @@
|
||||||
/* This css page is reserved for future use. */
|
.mmm-pages-slide-out {
|
||||||
|
transform: translateX(-200vw);
|
||||||
.fullscreen.above {
|
}
|
||||||
z-index: -1
|
.mmm-pages-slide-in {
|
||||||
}
|
transform: translateX(-100vw);
|
||||||
|
}
|
Loading…
Reference in a new issue