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

Responsive not working #277

Open
Andrew-Samir opened this issue May 23, 2024 · 0 comments
Open

Responsive not working #277

Andrew-Samir opened this issue May 23, 2024 · 0 comments

Comments

@Andrew-Samir
Copy link

Andrew-Samir commented May 23, 2024

I have an issue working with responsive option and items option in owl carousel
i use owl carousel in a container as follow

<div class="container">
            <div class="row">
                <div class="col-10 p-0 offset-1">
                    <owl-carousel-o [options]="customOptions">
                        <ng-container *ngFor="let theme of themes; let i = index">
                            <ng-template carouselSlide [width]="140" [id]="setCarouselID()">
                            <div class="theme-thumb" 
                                [ngClass]="{ selected: selected_theme && selected_theme.id === theme.id}" 
                                (click)="selectTheme(theme)"
                                [ngStyle]="{ backgroundImage: 'url(' + theme.file_preview + ')'}">
                            </div>
                            </ng-template>
                        </ng-container>
                    </owl-carousel-o>
                </div>
            </div>
        </div>
    i set a fixed width for 140 px and used autoWidth to true and i set items to 4 to show only 4 slides for large screens 
    here is my options
   ```

customOptions: OwlOptions = {
autoWidth: true,
loop: false,
margin: 16,
rewind: false,
dots: false,
navText: [ '<', '>' ],
mouseDrag: true,
touchDrag: true,
pullDrag: true,
navSpeed: 700,
nav: true,
responsive: {
0: {
items: 1
},
200: {
items: 2
},
400: {
items: 3
},
600: {
items: 4
}
},
}

  although considering the responsive is calculated from the parent width, its not working and the carousel showed 6 items for bigger screens and when resize it shrinks not using responsive 
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