if (direction == "left") { this.scrollImages( this.currentImg + distance / this.IMG_WIDTH , duration ); } else if (direction == "right") { this.scrollImages( this.currentImg - distance / this.IMG_WIDTH , duration ); }