gpt4 book ai didi

javascript - 在光滑的轮播中假装点击下一张幻灯片

转载 作者:行者123 更新时间:2023-12-02 23:12:23 24 4
gpt4 key购买 nike

我有一个简单的轮播 ( https://kenwheeler.github.io/slick/ ),但是在我的布局中,直到您浏览完第一组幻灯片后它才会正确显示。

为了解决这个问题,我只是将其设置为自动播放,但我实际上并不希望这种情况发生。

有没有办法伪造一个被点击的箭头?

编辑

$('.carousel').slick({
infinite: true,
speed: 500,
slidesToShow: 4,
slidesToScroll: 4,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 380,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
a{
display:inline-block;
width:200px !important;
height:200px !important;
border: 1px solid DarkGrey;
}
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script type="text/javascript" src="//cdn.jsdelivr.net/gh/kenwheeler/slick@1.8.1/slick/slick.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/gh/kenwheeler/slick@1.8.1/slick/slick.css"/>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/gh/kenwheeler/slick@1.8.1/slick/slick-theme.css"/>

<div class="card product">
<div class="card-header" id="related_heading">
<button class="btn btn-default collapsed w-100 h-100 text-left" data-toggle="collapse" data-target="#related_body" aria-expanded="false" aria-controls="related_body">
<h5><span>+</span> RELATED PRODUCTS</h5>
</button>
</div>
<div id="related_body" class="collapse" aria-labelledby="related_heading">
<div class="product card-body">
<div class="related-carousel">
<div class="carousel">

<a href="#">
<img src="" alt="" itemprop="image">
<p itemprop="name" class="product_name">product_name</p>
<b>€116.85</b>
</a>

<a href="#">
<img src="" alt="" itemprop="image">
<p itemprop="name" class="product_name">product_name</p>
<b>€116.85</b>
</a>

<a href="#">
<img src="" alt="" itemprop="image">
<p itemprop="name" class="product_name">product_name</p>
<b>€116.85</b>
</a>

<a href="#">
<img src="" alt="" itemprop="image">
<p itemprop="name" class="product_name">product_name</p>
<b>€116.85</b>
</a>

<a href="#">
<img src="" alt="" itemprop="image">
<p itemprop="name" class="product_name">product_name</p>
<b>€116.85</b>
</a>

</div>
</div>
</div>
</div>
</div>

请注意链接是如何相互排列的,除非您尝试拖动它们,然后它们会在轮播中内联。

最佳答案

您可以通过在 slick 实例上使用 slickNextslickPrev 方法以编程方式更改幻灯片。

关于javascript - 在光滑的轮播中假装点击下一张幻灯片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57290120/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com