vue-carousel-3d
vue-carousel-3d copied to clipboard
please add {passive: true} for "touchstart" and "touchmove" and "touchend" events.
Hi, Google says "Does not use passive listeners to improve scrolling performance". I need to add {passive: true} to "touchstart" and "touchmove" event.
this code :
if ('ontouchstart' in window) {
this.$el.addEventListener('touchstart', this.handleMousedown);
this.$el.addEventListener('touchend', this.handleMouseup);
this.$el.addEventListener('touchmove', this.handleMousemove);
} else {
this.$el.addEventListener('mousedown', this.handleMousedown);
this.$el.addEventListener('mouseup', this.handleMouseup);
this.$el.addEventListener('mousemove', this.handleMousemove);
}
must be replaced with below code:
if ('ontouchstart' in window) {
this.$el.addEventListener('touchstart', this.handleMousedown,{passive: true});
this.$el.addEventListener('touchend', this.handleMouseup,{passive: true});
this.$el.addEventListener('touchmove', this.handleMousemove,{passive: true});
} else {
this.$el.addEventListener('mousedown', this.handleMousedown);
this.$el.addEventListener('mouseup', this.handleMouseup);
this.$el.addEventListener('mousemove', this.handleMousemove);
}
please help me Thank you.