微件:轮播图:修订间差异
跳转到导航
跳转到搜索
无编辑摘要 |
无编辑摘要 |
||
(未显示同一用户的3个中间版本) | |||
第23行: | 第23行: | ||
img.src = obj.src; | img.src = obj.src; | ||
img.style.opacity = index === 0 ? 1 : 0; | img.style.opacity = index === 0 ? 1 : 0; | ||
img.style.pointerEvents = index === 0 ? 'auto' : 'none'; | |||
img.onclick = () => window.open(obj.link, '_blank'); | img.onclick = () => window.open(obj.link, '_blank'); | ||
slider.appendChild(img); | slider.appendChild(img); | ||
第33行: | 第34行: | ||
dotsContainer.children[0].classList.add('active'); | dotsContainer.children[0].classList.add('active'); | ||
let sliderPrev = document.getElementById('sliderPrev'); | |||
let sliderNext = document.getElementById('sliderNext'); | |||
sliderPrev.onclick = () => prevSlide(); | |||
sliderNext .onclick = () => nextSlide(); | |||
setInterval(() => { | setInterval(() => { | ||
第41行: | 第47行: | ||
Array.from(slider.children).forEach((slide, index) => { | Array.from(slider.children).forEach((slide, index) => { | ||
slide.style.opacity = index === currentSlide ? 1 : 0; | slide.style.opacity = index === currentSlide ? 1 : 0; | ||
slide.style.pointerEvents = index === currentSlide ? 'auto' : 'none'; | |||
}); | }); | ||