javascript - Swiper-slide displays vertically instead of horizontally - Stack Overflow

admin2025-04-22  0

My swiper-slide works well at first and I can scroll it horizontally, but after I used php to display my product details from my database and the swiper-slide now displays vertically instead of horizontally. And that is my problem - I want to display my swiper slide horizontally.

My swiper-slide works well at first and I can scroll it horizontally, but after I used php to display my product details from my database and the swiper-slide now displays vertically instead of horizontally. And that is my problem - I want to display my swiper slide horizontally.

Share Improve this question edited Sep 25, 2018 at 8:51 curveball 4,50515 gold badges45 silver badges52 bronze badges asked Sep 25, 2018 at 1:59 Mitch Frankein Mitch Frankein 311 silver badge3 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

Firstly, I was also facing the same error then I figure out that

"<link rel="stylesheet" href="https://unpkg./swiper/swiper-bundle.min.css" ">

the above link was not included in head of the HTML..... Please visit swiper website for the link. I hope it will be helpful.

By default swiper sets "direction" to "horizontal"
make sure you have set options correctly, try the following code

var swiper = new Swiper('.your-swiper-container', {
   'direction': 'horizontal'
});

//Using Method on page load, this will set the direction to horizontal on page load and after slider initialization

swiper.params.direction = "horizontal"; //for horizontal
swiper.update();
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745258798a292943.html

最新回复(0)