vue-slick-carousel icon indicating copy to clipboard operation
vue-slick-carousel copied to clipboard

Dots and arrows missing on load

Open JMartinesGH opened this issue 4 years ago • 6 comments

The dots and arrows are not loaded on the first load of my app, only when I leave the router view and return do the dots and arrows show up in the dom.

<template>
  <div class="container">
    <VueSlickCarousel :arrows="true" :dots="true" :infinite="false">
      <Post
        v-for="post in posts"
        :key="post.id"
        :post="post"
        :category="category"
        carousel="true"
      />
    </VueSlickCarousel>
  </div>
</template>

<script>
import VueSlickCarousel from 'vue-slick-carousel'
import 'vue-slick-carousel/dist/vue-slick-carousel.css'
import 'vue-slick-carousel/dist/vue-slick-carousel-theme.css'

import Post from '@/components/Post.vue'
export default {
  components: {
    VueSlickCarousel,
    Post
  },
  props: {
    category: String,
    posts: Object
  }
}
</script>

<style lang="scss">
.slick-dots {
  position: absolute;
  z-index: 998;
  right: calc(20% + 30px);
  top: 95%;
  width: auto;
  li button::before {
    font-size: 8px;
    color: #c6dcd9;
  }
  li.slick-active button::before {
    color: #38827c;
  }
}
</style>

JMartinesGH avatar Sep 04 '20 14:09 JMartinesGH

Try using slots for arrows and dots. That worked for me. You can find that in this example here under Customizing Arrows & Dots: https://gs-shop.github.io/vue-slick-carousel/#/api

haritha2112 avatar Sep 17 '20 15:09 haritha2112

I had to do this to get the arrows to show:

<style>
   .slick-next::before {
     color: black;
   }

   .slick-prev::before{
     color: black;
   }
</style>

vindhaus avatar Nov 14 '20 19:11 vindhaus

Added margin around div. Apparently, the arrows were outside the viewport

louisaoge avatar Dec 25 '20 13:12 louisaoge

I am using gridsome and in some cases arrows/dots were also hidden after some time or switching between pages.

I fix it using :key="$route.fullPath on slider component.

<vue-slick-carousel v-bind="config" :key="$route.fullPath">
 ...
</vue>

Maybe it could you folks.

f3l1x avatar Mar 18 '21 14:03 f3l1x

I'm having a similar problem. I dynamically load the slider images from an array. When the image array changes from 5 images, for example, to one image, the arrows disappear. But when I add new images to the array and the array gets with more than one image, the arrows don't appear again.

andrejrcarvalho avatar Sep 29 '21 13:09 andrejrcarvalho

Had the same issue. What worked for me was using custom arrows placed outside of the slick carousel component and applied the appropriate method to it as described in the example on https://gs-shop.github.io/vue-slick-carousel/#/api under "calling methods".

sscumac avatar Oct 12 '21 09:10 sscumac