vitalii-andriiovskyi / ngx-owl-carousel-o

owl-carousel for Angular >=6
MIT License
174 stars 51 forks source link

carousel element in different width #260

Open chenleiv opened 10 months ago

chenleiv commented 10 months ago

Hi, I have dynamic buttons that runs on the carousel, each button as different width and i want the owl-item will be in the same size of his child button.

image image image

all the slide in the same size no matter what the bouton size. I tried to change the width on the scss and also to override from js. nothing works.

please help. chen

vitalii-andriiovskyi commented 7 months ago

@chenleiv

Try with

customOptions: OwlOptions = {
     autoWidth: true,
   // ...
}
 <ng-template carouselSlide [id]="item.id" [width]="item.width">
          <div>Kramer India</div>
 </ng-template>

here [width]="item.width" should be the width of a button. Probably you will need to generate buttons before the library initialization to get buttons widths before.