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

My swiper-slide works well at first and I can scroll it horizontally, but after I used php to display m

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();

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745258797a4619114.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信