@@ -274,12 +274,12 @@ return /******/ (function(modules) { // webpackBootstrap
274274 index = nextIndex ;
275275 }
276276
277- if ( infinite ) {
278- if ( Math . abs ( nextOffset ) === maxOffset && direction ) {
277+ if ( infinite && ( Math . abs ( nextOffset ) === maxOffset || Math . abs ( nextOffset ) === 0 ) ) {
278+ if ( direction ) {
279279 index = infinite ;
280280 }
281281
282- if ( Math . abs ( nextOffset ) === 0 && ! direction ) {
282+ if ( ! direction ) {
283283 index = slides . length - infinite * 2 ;
284284 }
285285
@@ -458,27 +458,22 @@ return /******/ (function(modules) { // webpackBootstrap
458458 }
459459
460460 function onTouchstart ( event ) {
461- var touches = undefined ;
462-
463461 var _options6 = options ;
464462 var enableMouseEvents = _options6 . enableMouseEvents ;
465463
466- if ( enableMouseEvents ) {
467- touches = event . touches ? event . touches [ 0 ] : event ;
464+ var touches = event . touches ? event . touches [ 0 ] : event ;
468465
466+ if ( enableMouseEvents ) {
469467 slideContainer . addEventListener ( 'mousemove' , onTouchmove ) ;
470468 slideContainer . addEventListener ( 'mouseup' , onTouchend ) ;
471469 slideContainer . addEventListener ( 'mouseleave' , onTouchend ) ;
472- } else {
473- touches = event . touches [ 0 ] ;
474-
475- slideContainer . addEventListener ( 'touchmove' , onTouchmove ) ;
476- slideContainer . addEventListener ( 'touchend' , onTouchend ) ;
477470 }
478471
479- var _touches = touches ;
480- var pageX = _touches . pageX ;
481- var pageY = _touches . pageY ;
472+ slideContainer . addEventListener ( 'touchmove' , onTouchmove ) ;
473+ slideContainer . addEventListener ( 'touchend' , onTouchend ) ;
474+
475+ var pageX = touches . pageX ;
476+ var pageY = touches . pageY ;
482477
483478 touchOffset = {
484479 x : pageX ,
@@ -496,20 +491,9 @@ return /******/ (function(modules) { // webpackBootstrap
496491 }
497492
498493 function onTouchmove ( event ) {
499- var touches = undefined ;
500-
501- var _options7 = options ;
502- var enableMouseEvents = _options7 . enableMouseEvents ;
503-
504- if ( enableMouseEvents ) {
505- touches = event . touches ? event . touches [ 0 ] : event ;
506- } else {
507- touches = event . touches [ 0 ] ;
508- }
509-
510- var _touches2 = touches ;
511- var pageX = _touches2 . pageX ;
512- var pageY = _touches2 . pageY ;
494+ var touches = event . touches ? event . touches [ 0 ] : event ;
495+ var pageX = touches . pageX ;
496+ var pageY = touches . pageY ;
513497
514498 delta = {
515499 x : pageX - touchOffset . x ,
@@ -581,6 +565,7 @@ return /******/ (function(modules) { // webpackBootstrap
581565 slideContainer . removeEventListener ( 'touchend' , onTouchend ) ;
582566 slideContainer . removeEventListener ( 'mousemove' , onTouchmove ) ;
583567 slideContainer . removeEventListener ( 'mouseup' , onTouchend ) ;
568+ slideContainer . removeEventListener ( 'mouseleave' , onTouchend ) ;
584569
585570 dispatchSliderEvent ( 'on' , 'touchend' , {
586571 event : event
0 commit comments