Permalink
Browse files

fix(carousel): Prevent reflow trigger from being optimised out (#995)

* Update carousel.vue
  • Loading branch information...
tmorehouse committed Sep 6, 2017
1 parent 3c5a94c commit d765976d7286c0379f31d1f2209b787cb1704617
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/components/carousel.vue
@@ -114,6 +114,12 @@
return null;
}
// Function to trigger a reflow of an element layout
// To help prevent this line from being optimized out
function reflow(el) {
return el.offsetHeight;
}
export default {
mixins: [ idMixin ],
data() {
@@ -331,8 +337,7 @@
nextSlide.classList.add(direction.overlayClass);
// Trigger a reflow of next slide
// eslint-disable-next-line no-void
void(nextSlide.offsetHeight);
reflow(nextSlide);
currentSlide.classList.add(direction.dirClass);
nextSlide.classList.add(direction.dirClass);

0 comments on commit d765976

Please sign in to comment.