We're using the CSS zoom property, and it causes the carousel to calculate the incorrect distance to move the slides.
It can be reproduced on the splidejs homepage as well, here I added zoom: 1.25 on the body tag, and transitioned the carousel to the second slide. The third slide should not be visible here, but it is.
I attempted a work around using a custom transition to adjust the value it uses to translate the slides:
// Converts the index to the position
const destination = Move.toPosition(index, true);
...
let zoomDelta = 0;
if (viewportWidth >= 1950) {
zoomDelta = destination * 0.1667;
} else if (viewportWidth >= 1700) {
zoomDelta = destination * 0.115;
} else if (viewportWidth >= 1550) {
zoomDelta = destination * 0.04764;
}
...
// Moves the carousel to the destination.
Move.translate(destination - zoomDelta);
...
But, it turned out what worked for Chrome did not work in Firefox. In Safari, it seems to work out of the box, so at least part of the issue might be how different browsers handle the zoom.
I tried using the same reproduction steps on the carousel page in shadcdn, and I can't see the same problem in Chrome.
Reproduction Link
No response
Steps to Reproduce
On the splidejs home page, add zoom: 1.25 to the body tag
Click next slide on the first carousel
The third slide is now visible. Without the zoom set, it is not visible.
Checks
Version
v4.1.3
Description
We're using the CSS zoom property, and it causes the carousel to calculate the incorrect distance to move the slides.
It can be reproduced on the splidejs homepage as well, here I added
zoom: 1.25
on the body tag, and transitioned the carousel to the second slide. The third slide should not be visible here, but it is.I attempted a work around using a custom transition to adjust the value it uses to translate the slides:
But, it turned out what worked for Chrome did not work in Firefox. In Safari, it seems to work out of the box, so at least part of the issue might be how different browsers handle the zoom.
I tried using the same reproduction steps on the carousel page in shadcdn, and I can't see the same problem in Chrome.
Reproduction Link
No response
Steps to Reproduce
zoom: 1.25
to the body tagExpected Behaviour
The third slide should not be visible.