简体   繁体   English

如何修复Swouse Js初始加载轮播?

[英]How to fix Swiper Js initial loading for a Carousel?

I am using the swiper js: https://idangero.us/swiper/api/ but the problem is when used the initial loading shows the single carousel item first then remaining items starts showing up. 我正在使用swiper js: https ://idangero.us/swiper/api/但问题是在使用初始加载时首先显示单个轮播项目然后剩余项目开始显示。 Which behaves like a glitch. 这表现得像一个小故障。

Making is clearer. 制作更清晰。 If i load the website i will only see the first item in the carousel (in the red box) then it will change to layout like in the image with 4 items. 如果我加载网站我将只看到旋转木马中的第一个项目(在红色框中)然后它将更改为布局,如图像中有4个项目。

I could find that if i set max-width:25%; 如果我设置max-width:25%;我会发现 that will fix the issue for this case. 这将解决此案例的问题。 But if there are 2 items in the carousel per view that css code will fix the width 25%. 但如果每个视图的轮播中有2个项目,则css代码将固定宽度为25%。

Is there any way to fix it? 有什么办法可以解决吗? Please help 请帮忙

在此输入图像描述

Change the point of the initialization function call to the point at which all images were downloaded. 将初始化函数调用的点更改为下载所有图像的点。

$( window ).load(function() {
    var mySwiper = new Swiper ('.swiper-container', {
      // ...
    })
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM