Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bullets slot or prop #67

Open
peppeg85 opened this issue Jun 21, 2021 · 4 comments
Open

bullets slot or prop #67

peppeg85 opened this issue Jun 21, 2021 · 4 comments

Comments

@peppeg85
Copy link

peppeg85 commented Jun 21, 2021

hello i'm trying to add the bullets to my carousel, but nothing shows, i added :bullet="true" prop and inspecting the html there are the bullets, but nothing shows, any suggestions?

here is the html:

<vue-glide class=""
                 type="slider"
                 :rewind="true"
                 :rewind-duration="0"
                 :bound="false"
                 :autoplay="5000"
                 :animation-duration="3000"
                 :gap="10"
                 :per-view="1"
                 :bullet="true"
      >
        <vue-glide-slide v-for="(item,index) in items"
                         :key="index"
                         class="block relative py-16 w-full justify-center px-10"
        >
          <div class="w-full grid grid-cols-12">
            <div class="rounded-xl col-span-5">
              <div class="relative">
                <div class="pt-3">
                  <img
                      :src="item.image"
                      :alt="item.title"
                      class="object-cover h-77 rounded-xl z-10"
                  >
                </div>
              </div>
            </div>
            <div class="col-span-7 flex flex-col justify-between">
              <div class="text-left font-semibold text-3xl line-clamp-2">
                {{ item.title }}
              </div>
              <div class="text-left font-normal text-lg line-clamp-3">
                Lorem Ipsum is simply dummy text of the printing and typesetting industry.
                Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown
                printer took a
                galley of type
              </div>
            </div>
          </div>
        </vue-glide-slide>
      </vue-glide>

inside the html i have:

<div data-glide-el="controls[nav]" class="glide__bullets h-20">
<button data-glide-dir="=0" class="glide__bullet"></button>
<button data-glide-dir="=1" class="glide__bullet"></button>
<button data-glide-dir="=2" class="glide__bullet glide__bullet--active">
</button><button data-glide-dir="=3" class="glide__bullet"></button>
<button data-glide-dir="=4" class="glide__bullet"></button>
<button data-glide-dir="=5" class="glide__bullet"></button>
<button data-glide-dir="=6" class="glide__bullet"></button></div>

and the glide works, i can see the glide__bullet glide__bullet--active class switch between the bullets, i think is some css issue

the slide section is ok, just the bullets didn't show
thanks for your help

@peppeg85
Copy link
Author

i tried overwriting the glide classes, for example:

<style scoped>
.glide__bullets {
  background-color: #1d1d1d;
  height: 40px
}

.glide__bullet {
  background-color: red;
  height: 20px;
  width:20px;
  border-radius: 50%;
}

.glide__bullet--active {
  background-color: yellow;
}
</style>

but without success

@peppeg85
Copy link
Author

peppeg85 commented Jun 21, 2021

i tried also with the slot control, as you say in the documentation:

   <template slot="control">
          <div class="flex inline-flex w-full justify-center bg-black">
            <button v-for="(el, index) in items" class="h-6 w-6 rounded-full bg-white" :data-glide-dir="'='+index">
            </button>
          </div>
        </template>

but i have this error in the console:

vue-glide.common.js:2209 Uncaught TypeError: Cannot read property 'slice' of null
    at Object.resolve (vue-glide.common.js:2209)
    at HTMLDivElement.click (vue-glide.common.js:3408)

@peppeg85
Copy link
Author

sorry for all the posts, i solved in this way:

  <template slot="control">
         <button
             v-for="(el, index) in items"
             class="h-6 w-6 rounded-full"
             :class="active==index?'bg-red-600':'bg-gray-500'"
             :data-glide-dir="'='+index" :key="index"
         >
         </button>
       </template>

if it could help someone, but please, update the docs

@peppeg85
Copy link
Author

peppeg85 commented Aug 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant