@@ -18,6 +18,7 @@ define([
18
18
zoomInButtonSelector = '[data-gallery-role="fotorama__zoom-in"]' ,
19
19
zoomOutButtonSelector = '[data-gallery-role="fotorama__zoom-out"]' ,
20
20
fullscreenImageSelector = '[data-gallery-role="stage-shaft"] [data-active="true"] .fotorama__img--full' ,
21
+
21
22
imageDraggableClass = 'fotorama__img--draggable' ,
22
23
imageZoommable = 'fotorama__img--zoommable' ,
23
24
zoomInLoaded = 'zoom-in-loaded' ,
@@ -31,10 +32,11 @@ define([
31
32
endX ,
32
33
transitionEnabled ,
33
34
transitionActive = false ,
34
- tapFlag = 0 ,
35
+ tapFlag ,
35
36
allowZoomOut = false ,
36
37
allowZoomIn = true ;
37
38
39
+ tapFlag = new Date ( ) . getTime ( ) ;
38
40
transitionEnabled = document . documentElement . style . transition !== undefined ||
39
41
document . documentElement . style . WebkitTransition !== undefined ||
40
42
document . documentElement . style . MozTransition !== undefined ||
@@ -638,24 +640,18 @@ define([
638
640
var now = new Date ( ) . getTime ( ) ,
639
641
timesince = now - tapFlag ;
640
642
641
- if ( timesince < 400 && timesince > 0 ) {
643
+ if ( timesince < 2000 && timesince > 400 ) {
642
644
transitionActive = false ;
643
- tapFlag = 0 ;
644
645
dblClickHandler ( e ) ;
645
- } else {
646
- tapFlag = new Date ( ) . getTime ( ) ;
647
646
}
647
+ tapFlag = now ;
648
648
}
649
649
650
- $image . off ( 'tap' ) ;
651
- $image . on ( 'tap' , function ( e ) {
652
- if ( e . originalEvent . originalEvent . touches . length === 0 ) {
653
- detectDoubleTap ( e ) ;
654
- }
655
- } ) ;
656
-
657
650
$image . off ( 'dblclick' ) ;
658
651
$image . on ( 'dblclick' , detectDoubleTap ) ;
652
+ $image . on ( 'click' , function ( e ) {
653
+ detectDoubleTap ( e ) ;
654
+ } ) ;
659
655
660
656
if ( gallery . fullScreen ) {
661
657
toggleZoomButtons ( $image , isTouchEnabled , checkForVideo ( fotorama . activeFrame . $stageFrame ) ) ;
@@ -822,10 +818,12 @@ define([
822
818
823
819
isDragActive = false ;
824
820
$image . removeClass ( imageDraggableClass ) ;
821
+ }
822
+ } ) ;
825
823
826
- if ( isTouchEnabled ) {
827
- detectDoubleTap ( e ) ;
828
- }
824
+ $image . on ( 'touchend' , function ( e ) {
825
+ if ( isTouchEnabled && gallery . fullScreen ) {
826
+ detectDoubleTap ( e ) ;
829
827
}
830
828
} ) ;
831
829
0 commit comments