Creating a slider/carousel with pagination and arrows in Webflow using the Swiper integration involves several steps. Additionally, adjusting breakpoints to display only one slide on mobile requires precise configuration. Here's how you can achieve these customizations:
1. Add Swiper Integration to Webflow
- Access Project Settings and navigate to the Custom Code tab.
- In the Footer Code section, include the Swiper JS and CSS links by integrating inline references.
2. Configure Swiper in Webflow
- Add a Div Block to initialize your Swiper container and assign a class to it for styling.
- Inside the Div Block, add child Divs to represent slides and assign necessary Swiper-specific class names like
swiper-slide.
3. Add Pagination and Navigation Arrows
- Include additional Div Blocks for pagination and navigation arrows inside your Swiper container.
- Assign the class
swiper-pagination to the pagination Div and swiper-button-next & swiper-button-prev for navigation arrows.
4. Implement Swiper Script
- Use a script in the Footer Code Custom section, detailing your Swiper configuration.
- Ensure your configuration includes:
- Pagination:
pagination: { el: '.swiper-pagination', clickable: true } - Navigation:
navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev' }
5. Adjust Breakpoints for Mobile
- Modify the Swiper initialization script to include custom breakpoints, setting slide display for mobile.
- Example:
```js
breakpoints: {
320: { slidesPerView: 1 },
640: { slidesPerView: 2 }
}
```
- This configuration should ensure that only one slide is displayed on screen widths up to 640px.
6. Validate and Publish
- Save changes and Publish the site to see the Swiper slider operational with the configured settings.
Troubleshooting Common Issues
- Ensure Swiper's CSS and JS links are correctly placed and loading without errors.
- Confirm class names match those used in the HTML layout.
- Test on different devices to verify mobile breakpoint settings.
Summary
Integrate Swiper in Webflow by configuring the slider with classes for pagination and navigation, ensuring your script includes correct Swiper settings, and defining breakpoints in the script to customize slide display on mobile. Always validate and test across devices after any changes. If issues persist, review your custom code and class names for inconsistencies.