vue-carousel-3d icon indicating copy to clipboard operation
vue-carousel-3d copied to clipboard

please add {passive: true} for "touchstart" and "touchmove" and "touchend" events.

Open nekooee opened this issue 4 years ago • 0 comments

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.

nekooee avatar Nov 16 '21 12:11 nekooee