自动滚动 随悬停停止

This commit is contained in:
张 元山 2025-03-14 18:05:00 +08:00
parent e8c74caab7
commit de0665b336

View File

@ -40,6 +40,10 @@
</div>
<div
class="mt-[140px] mb-[230px] carousel-container px-[80px] py-[40px] z-6"
@mouseenter="pauseCarouselAnimation"
@mouseleave="resumeCarouselAnimation"
@touchstart="pauseCarouselAnimation"
@touchend="resumeCarouselAnimation"
>
<div ref="carouselTrack" class="carousel-track">
<div
@ -751,6 +755,19 @@ const goToSection = (i) => {
const handleLink = (url) => {
window.open(url);
};
//
const pauseCarouselAnimation = () => {
if (carouselAnimation) {
carouselAnimation.pause();
}
};
const resumeCarouselAnimation = () => {
if (carouselAnimation) {
carouselAnimation.play();
}
};
</script>
<style scoped lang="scss">