'commit'
This commit is contained in:
@@ -25,8 +25,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
startCarousel();
|
||||
|
||||
// 绑定控制按钮事件
|
||||
prevBtn.addEventListener('click', prevSlide);
|
||||
nextBtn.addEventListener('click', nextSlide);
|
||||
if (prevBtn && nextBtn) {
|
||||
prevBtn.addEventListener('click', prevSlide);
|
||||
nextBtn.addEventListener('click', nextSlide);
|
||||
}
|
||||
|
||||
// 绑定指示点事件
|
||||
carouselIndicators.forEach((indicator, index) => {
|
||||
@@ -35,10 +37,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
});
|
||||
});
|
||||
|
||||
// Lines 39-45
|
||||
|
||||
// 鼠标悬停时暂停轮播
|
||||
const carousel = document.querySelector('.carousel');
|
||||
carousel.addEventListener('mouseenter', pauseCarousel);
|
||||
carousel.addEventListener('mouseleave', startCarousel);
|
||||
if (carousel) {
|
||||
carousel.addEventListener('mouseenter', pauseCarousel);
|
||||
carousel.addEventListener('mouseleave', startCarousel);
|
||||
}
|
||||
}
|
||||
|
||||
// 显示指定幻灯片
|
||||
|
Reference in New Issue
Block a user