pull/1/head
Jan Umbach 2024-05-30 10:24:15 +02:00
parent 9c4d39168e
commit d0a63d9e14
1 changed files with 12 additions and 10 deletions

View File

@ -50,6 +50,17 @@
// play video on hover
this.productCard.addEventListener('mouseenter', this.playVideo.bind(this));
this.productCard.addEventListener('mouseleave', this.pauseVideo.bind(this));
// also make it mobile friendly
this.productCard.addEventListener('touchstart', this.hoverEffectIn.bind(this));
this.productCard.addEventListener('touchend', this.hoverEffectOut.bind(this));
this.productCard.addEventListener('touchstart', this.playVideo.bind(this));
this.productCard.addEventListener('touchend', this.pauseVideo.bind(this));
}
hoverEffectIn() {
@ -81,16 +92,7 @@
pauseVideo() {
this.video.pause();
}
togglePlay() {
if (this.video.paused) {
this.video.play();
} else {
this.video.pause();
}
}
}
// dom ready