Skip to content

Commit 761bc93

Browse files
Hiwsjacobmllr95
andauthored
fix(b-carousel): fix glitching when switching slides fast (closes #5810) (#5845)
* fix glitchingg * Update carousel.js Co-authored-by: Jacob Müller <[email protected]>
1 parent 9ed1060 commit 761bc93

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/carousel/carousel.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
getActiveElement,
1111
reflow,
1212
removeClass,
13+
requestAF,
1314
selectAll,
1415
setAttr
1516
} from '../../utils/dom'
@@ -269,7 +270,10 @@ export const BCarousel = /*#__PURE__*/ Vue.extend({
269270
// Don't change slide while transitioning, wait until transition is done
270271
if (this.isSliding) {
271272
// Schedule slide after sliding complete
272-
this.$once('sliding-end', () => this.setSlide(slide, direction))
273+
this.$once('sliding-end', () => {
274+
// Wrap in `requestAF()` to allow the slide to properly finish to avoid glitching
275+
requestAF(() => this.setSlide(slide, direction))
276+
})
273277
return
274278
}
275279
this.direction = direction

0 commit comments

Comments
 (0)