0
A
回答
0
使用的时间间隔,您可以在您的无线电模拟点击...
var delay = 1500;
var sliderRadios = document.getElementsByName("carousel-3d");
var index=0
var imageCount = sliderRadios.length;
setInterval(function(){
index++;
if(index>imageCount-1){
index=0;
}
sliderRadios[index].click();
console.log(sliderRadios[index].id);
},delay);
.slider-container {
position: relative;
perspective: 350px;
transform-style: preserve-3d;
}
.carousel-3d-item {
position: absolute;
top: 50%;
left: 40%;
outline: 1px solid transparent;
}
#carousel-3d-controller-2 ~ .carousel-3d-item:nth-of-type(1),
#carousel-3d-controller-1 ~ .carousel-3d-item:nth-of-type(1),
#carousel-3d-controller-2 ~ .carousel-3d-item:nth-of-type(2),
#carousel-3d-controller-1 ~ .carousel-3d-item:nth-of-type(2),
#carousel-3d-controller-2 ~ .carousel-3d-item:nth-of-type(3),
#carousel-3d-controller-1 ~ .carousel-3d-item:nth-of-type(3),
{
transition: all 1s cubic-bezier(.48, .16, .15, .98);
}
.carousel-3d-item:nth-of-type(2),
#carousel-3d-controller-1:checked ~ .carousel-3d-item:nth-of-type(2),
#carousel-3d-controller-2:checked ~ .carousel-3d-item:nth-of-type(3),
#carousel-3d-controller-3:checked ~ .carousel-3d-item:nth-of-type(1) {
transform: translateX(-175px) translateZ(-130px);
opacity: .9;
transition: all 1s cubic-bezier(.48, .16, .15, .98);
}
.carousel-3d-item:nth-of-type(1),
#carousel-3d-controller-1:checked ~ .carousel-3d-item:nth-of-type(1),
#carousel-3d-controller-2:checked ~ .carousel-3d-item:nth-of-type(2),
#carousel-3d-controller-3:checked ~ .carousel-3d-item:nth-of-type(3) {
transform: translateX(0) translateZ(0);
opacity: 1;
transition: all 1s cubic-bezier(.48, .16, .15, .98);
}
.carousel-3d-item:nth-of-type(3),
#carousel-3d-controller-1:checked ~ .carousel-3d-item:nth-of-type(3),
#carousel-3d-controller-2:checked ~ .carousel-3d-item:nth-of-type(1),
#carousel-3d-controller-3:checked ~ .carousel-3d-item:nth-of-type(2) {
transform: translateX(175px) translateZ(-130px);
opacity: .9;
transition: all 1s cubic-bezier(.48, .16, .15, .98);
}
<div class="slider-container">
<figure id="carousel--3d">
<input type="radio" name="carousel-3d" id="carousel-3d-controller-1" />
<input type="radio" name="carousel-3d" id="carousel-3d-controller-2" />
<input type="radio" name="carousel-3d" id="carousel-3d-controller-3" />
<label for="carousel-3d-controller-1" class="carousel-3d-item">
<div class="slide-img">
<img src="https://unsplash.it/400/250?image=974" alt="" />
</div>
<div class="slide-content">
<img src="assets/dist/img/easy.png">
<p>Win Discounts cccc</p>
</div>
</label>
<label for="carousel-3d-controller-2" class="carousel-3d-item">
<div class="slide-img">
<img src="https://unsplash.it/400/250?image=974" alt="" />
</div>
<div class="slide-content">
<img src="assets/dist/img/easy.png">
<p>Win Discounts bbbb</p>
</div>
</label>
<label for="carousel-3d-controller-3" class="carousel-3d-item">
<div class="slide-img">
<img src="https://unsplash.it/400/250?image=974" alt="" />
</div>
<div class="slide-content">
<img src="assets/dist/img/easy.png">
<p>Win Discounts aaaa</p>
</div>
</label>
</figure>
</div>
您在整页(在右上角的链接)的片段更好看。
+0
由于其工作 –
+0
为什么取消接受?有问题吗? –
0
我不完全知道如何只用CSS做到这一点,但它是很容易做到的JavaScript 。
let selected = 0;
const buttons = document.querySelectorAll('input');
setInterval(() => {
buttons[(selected++) % buttons.length].click();
}, 1000);
本工程为您简单的例子,但是你可能需要一个更具体的选择对于较大的应用程序见document.querySelector。
+0
由于其工作 –
相关问题
- 1. 如何使CSS滑块自动播放
- 2. Javascript滑块自动播放
- 3. 自动播放的滑块
- 4. 从自动播放循环中的第一个滑块自动播放滑块
- 5. 添加自动播放功能的jQuery localScroll滑块
- 6. 添加自动播放+先前&下按钮滑块
- 7. 添加自动播放到基本的jQuery滑块
- 8. 如何将自动播放添加到此滑块
- 9. Ajax JQuery滑块自动播放
- 10. 自动播放全屏背景滑块
- 11. 使用jQuery自动播放滑块
- 12. 使此滑块自动播放
- 13. 如何自动播放jQuery滑块?
- 14. jquery图像滑块自动播放
- 15. 自动播放的onClick - 的JavaScript滑块
- 16. 使用jQuery,javascript和css自动播放图像滑块
- 17. 在此链接滑块上自动播放 - 工作示例
- 18. 在背景图像滑块上自动播放
- 19. 滑动滑块 - 同步自动播放和主动导航
- 20. jQuery滑块,自动播放SWF时滑动到
- 21. 旋转木马滑块自动播放后,其加载ajax
- 22. 在Nivo滑块上播放/暂停Btn
- 23. 上一张幻灯片和自动播放Jquery滑块,
- 24. 谁能帮我添加一个正确的自动播放Wallop滑块
- 25. 自动播放光滑滑块内的视频
- 26. 油滑滑块自动播放不工作
- 27. 制作css自动滑块
- 28. 如何让Fotorama滑块在播放视频后自动播放幻灯片并结束于滑块?
- 29. 如何在使用CSS的滑动滑块JS中添加自定义箭头
- 30. 自动点击滑块上的项目符号为所有幻灯片自动播放滑块
https://codepen.io/km_likhon/pen/GELoap –
你应该把链接/代码放在你的问题。 –
https://codepen.io/km_likhon/pen/GELoap 这里是问题,我不能添加链接 看到此链接感谢 @JeroenHeier –