Skip to content

Commit d130243

Browse files
authored
ENGCOM-4643: Fotorama - disabling swipe on the item with class "disableSwipe" #22089
2 parents 26e3142 + 7abfdb5 commit d130243

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/web/fotorama/fotorama.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,12 +1399,13 @@ fotoramaVersion = '4.6.4';
13991399
touchFLAG,
14001400
targetIsSelectFLAG,
14011401
targetIsLinkFlag,
1402+
isDisabledSwipe,
14021403
tolerance,
14031404
moved;
14041405

14051406
function onStart(e) {
14061407
$target = $(e.target);
1407-
tail.checked = targetIsSelectFLAG = targetIsLinkFlag = moved = false;
1408+
tail.checked = targetIsSelectFLAG = targetIsLinkFlag = isDisabledSwipe = moved = false;
14081409

14091410
if (touchEnabledFLAG
14101411
|| tail.flow
@@ -1415,6 +1416,7 @@ fotoramaVersion = '4.6.4';
14151416

14161417
touchFLAG = e.type === 'touchstart';
14171418
targetIsLinkFlag = $target.is('a, a *', el);
1419+
isDisabledSwipe = $target.hasClass('disableSwipe');
14181420
controlTouch = tail.control;
14191421

14201422
tolerance = (tail.noMove || tail.noSwipe || controlTouch) ? 16 : !tail.snap ? 4 : 0;
@@ -1428,7 +1430,7 @@ fotoramaVersion = '4.6.4';
14281430

14291431
touchEnabledFLAG = tail.flow = true;
14301432

1431-
if (!touchFLAG || tail.go) stopEvent(e);
1433+
if (!isDisabledSwipe && (!touchFLAG || tail.go)) stopEvent(e);
14321434
}
14331435

14341436
function onMove(e) {
@@ -1441,6 +1443,12 @@ fotoramaVersion = '4.6.4';
14411443
return;
14421444
}
14431445

1446+
isDisabledSwipe = $(e.target).hasClass('disableSwipe');
1447+
1448+
if (isDisabledSwipe) {
1449+
return;
1450+
}
1451+
14441452
extendEvent(e);
14451453

14461454
var xDiff = Math.abs(e._x - startEvent._x), // opt _x → _pageX

0 commit comments

Comments
 (0)