avinoamr / bootstrap-carousel-swipe

Adding swipe behavior to Bootstrap's Carousel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Touch Swipe also in desktop mode

kampiamodikuesto opened this issue · comments

Hi, i'm finding a way to make this script useful also for desktop mode so i try addending this code:

...

this.$element
      .on('touchstart',        $.proxy(this.touchstart,this))
      .on('touchmove',         $.proxy(this.touchmove,this))
      .on('touchend',          $.proxy(this.touchend,this))

      /*  onmousedown, onmousemove, onmouseup */
      .on('onmousedown',        $.proxy(this.onmousedown,this))
      .on('onmousemove',         $.proxy(this.onmousemove,this))
      .on('onmouseup',          $.proxy(this.onmouseup,this))
      /*  END */

      .on('slide.bs.carousel', $.proxy(this.sliding, this))
      .on('slid.bs.carousel',  $.proxy(this.stopSliding, this))

 ...
...

/* onmousedown, onmousemove, onmouseup */
    
  CarouselSwipe.prototype.onmousedown = function(e) {
    if (this.sliding || !this.options.swipe) return;
    
    var touch = e // e.originalEvent.touches ? e.originalEvent.touches[0] : e

...

CarouselSwipe.prototype.onmousemove = function(e) {
    if (this.sliding || !this.options.swipe) return;

    var touch = e // e.originalEvent.touches ? e.originalEvent.touches[0] : e

...

CarouselSwipe.prototype.onmouseup = function(e) {

...

has samone a solution for this? i think the problem is the corrispective of e.orgianlEvent.touches for mouse event.