@@ -84,9 +84,9 @@ $(document).ready(function () {
8484 } ) ;
8585 } ) ;
8686
87- $ ( window ) . on ( 'dragenter' , function ( ) {
88- $ ( '#uploadModal' ) . modal ( 'show' ) ;
89- } ) ;
87+ $ ( window ) . on ( 'dragenter' , function ( ) {
88+ $ ( '#uploadModal' ) . modal ( 'show' ) ;
89+ } ) ;
9090} ) ;
9191
9292// ======================
@@ -404,6 +404,33 @@ function preview(items) {
404404 carousel . children ( '.carousel-indicators' ) . append ( carouselIndicator ) ;
405405 } ) ;
406406
407+
408+ // carousel swipe control
409+ var touchStartX = null ;
410+
411+ carousel . on ( 'touchstart' , function ( event ) {
412+ var e = event . originalEvent ;
413+ if ( e . touches . length == 1 ) {
414+ var touch = e . touches [ 0 ] ;
415+ touchStartX = touch . pageX ;
416+ }
417+ } ) . on ( 'touchmove' , function ( event ) {
418+ var e = event . originalEvent ;
419+ if ( touchStartX != null ) {
420+ var touchCurrentX = e . changedTouches [ 0 ] . pageX ;
421+ if ( ( touchCurrentX - touchStartX ) > 60 ) {
422+ touchStartX = null ;
423+ carousel . carousel ( 'prev' ) ;
424+ } else if ( ( touchStartX - touchCurrentX ) > 60 ) {
425+ touchStartX = null ;
426+ carousel . carousel ( 'next' ) ;
427+ }
428+ }
429+ } ) . on ( 'touchend' , function ( ) {
430+ touchStartX = null ;
431+ } ) ;
432+ // end carousel swipe control
433+
407434 notify ( carousel ) ;
408435}
409436
0 commit comments