I want to get translateX of swiper-wrapper
real-time. I will use the real-time translateX
to do some works.
swiper.on('sliderMove', function onSliderMove() {
console.log(this.getTranslate(), this.translate); //-64 -64, or maybe other value, but not -320
});
I listen to sliderMove
event, but the result is not correct.
I inspect the swiper-wrapper
element, the style is
transition-duration: 0ms;
transform: translate3d(-320px, 0px, 0px);
I expect the value of this.getTranslate()
should be -320
, not -64
listen on setTranslate
event will work.
swiper.on('setTranslate', function onSliderMove() {
console.log(this.translate);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With