如何解决光滑滑块中的项目无法正确呈现
我在使用Slick Slider(js)时遇到了问题,该问题是在原始幻灯片之后立即加载幻灯片的克隆,因此幻灯片及其克隆会依次显示(请参见img)。
这是我初始化$(document).ready()上的滑块的方式:
$('.carousel').slick({
dots: false,infinite: true,speed: 600,slidesToShow: 2,autoplay: true,prevArrow: '<div class="slick-prev"><i class="mdi mdi-chevron-left"></i></div>',nextArrow: '<div class="slick-next"><i class="mdi mdi-chevron-right"></i></div>'
})
编辑:
@EdLucas,这是HTML代码:
$html = '<div class="carousel" id="'.$client.'">';
$html .= '<div class="prod" id="'.$id.'">
<a href="'.$offerUrl.'" class="'.$id.'" data-lbc="'.$data.'" onclick="filterClick(event)">
<figure class="prod-image">
<img src="'.$imgurl['newurl'].'" width="'.$imgurl['dim'].'" height="'.$imgurl['dim'].'" loading="lazy" />';
if($fprice != null && $fprice > $price):
$html .= '<span class="discount">'.-floor(100 - $price/$fprice * 100) .'%</span>';
endif;
$html .=
$html .= '</figure>
<div class="prod-Meta">
<span>'.$name.'</span>
<span class="price">'.$offer->price.$currency.'</span>
<h4>'.$title.'</h4>
</div>
</a>
</div>
</div>';
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。