Footer: Animation depend on the direction.
This commit is contained in:
parent
a68ba0aa74
commit
870b6dbdfb
1 changed files with 4 additions and 3 deletions
|
@ -14,17 +14,18 @@
|
|||
|
||||
function slideText(event) {
|
||||
const id = event.detail.id;
|
||||
const width = window.innerWidth;
|
||||
const width = window.innerWidth/2;
|
||||
const animTranslate = active > id ? [width, -width] : [-width, width];
|
||||
|
||||
anime({
|
||||
targets: pageDiv,
|
||||
translateX: width / 2,
|
||||
translateX: animTranslate[0],
|
||||
opacity: 0,
|
||||
duration: 300,
|
||||
easing: 'easeInQuad',
|
||||
complete: function () {
|
||||
active = id;
|
||||
pageDiv.style.transform = `translateX(-${width}px)`;
|
||||
pageDiv.style.transform = `translateX(${animTranslate[1]}px)`;
|
||||
anime({
|
||||
targets: pageDiv,
|
||||
translateX: 0,
|
||||
|
|
Loading…
Add table
Reference in a new issue