初始负载中猫头鹰传送带宽度有问题 [英] Having Trouble with Owl Carousel Width in initial load
问题描述
我正在研究owl-carousel
.目前,我有一个问题,我的滑块宽度表现得很差.
I am working on owl-carousel
. Currently I have a problem that my slider width is acting really bad.
当我加载/刷新网站时,owl-carousel
具有一定的宽度值,但是下一张幻灯片的一部分是可见的(我想避免这种情况).在初始加载后,同时调整窗口大小(切换最大化或通过拖动更改宽度或高度)的同时,它会将宽度设置为所需的正确值.我不明白为什么会这样.我想在最初的负荷中避免这种习惯.
When I load/refresh the website, owl-carousel
has some value in width, but a part of the next slide is visible (I want to avoid that). At the same time after the initial load when I resize the window (toggle maximize, or change the width or height by dragging) it sets the width to the correct value as I wanted. I don't understand why it's happening. I want to prevent that habit in the initial load.
这是我的jQuery.
Here is my jQuery.
function newsSlider() {
$('.news-slider .owl-carousel').owlCarousel({
autoplay: true,
autoplayHoverPause: true,
dots: true,
loop: true,
margin: 5,
items: 3,
responsive: {
0: {
items: 1,
},
768: {
items: 2,
},
992: {
items: 3,
}
}
});
}
推荐答案
托管通过设置fixed width
解决此问题.我知道这是一个坏习惯.如果有人能提出解决此问题的正确方法,我们将不胜感激.谢谢.
Managed Solve the issue by setting fixed width
. I know it's a bad practice. If anyone can come up with a proper way to solve this, you are welcomed. Thank you.
这篇关于初始负载中猫头鹰传送带宽度有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!