test
parent
9c4d39168e
commit
d0a63d9e14
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue