always scrollcontainer by page width on move
This commit is contained in:
parent
01529cc981
commit
5389d4fc13
1 changed files with 8 additions and 6 deletions
|
@ -162,6 +162,7 @@
|
|||
|
||||
const moveUpButtonCallback = e => {
|
||||
var imgContainer = e.target;
|
||||
const startingPosition = imgContainer.getBoundingClientRect();
|
||||
while (!imgContainer.classList.contains("page-container")) {
|
||||
imgContainer = imgContainer.parentNode;
|
||||
}
|
||||
|
@ -169,9 +170,10 @@
|
|||
if (sibling) {
|
||||
pagesContainer.removeChild(imgContainer);
|
||||
pagesContainer.insertBefore(imgContainer, sibling);
|
||||
imgContainer.scrollIntoView({
|
||||
behavior: "instant",
|
||||
block: "center",
|
||||
|
||||
const { width } = imgContainer.getBoundingClientRect();
|
||||
pagesContainerWrapper.scroll({
|
||||
left: pagesContainerWrapper.scrollLeft - width,
|
||||
})
|
||||
}
|
||||
};
|
||||
|
@ -188,9 +190,9 @@
|
|||
} else {
|
||||
pagesContainer.appendChild(imgContainer)
|
||||
}
|
||||
imgContainer.scrollIntoView({
|
||||
behavior: "instant",
|
||||
block: "center",
|
||||
const { width } = imgContainer.getBoundingClientRect();
|
||||
pagesContainerWrapper.scroll({
|
||||
left: pagesContainerWrapper.scrollLeft + width,
|
||||
})
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue