How to fix Magento Fotorama module bug

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...

MagentoAs you know, Magento 2 has a defect, which is present at 2.1.2. as well as in the previous versions. This is a problem related to vertical rolling of the product image on the product’s details page. This is the mobile devices module – Fotorama.
When we try to scroll down the page while being at the image, we turn over it left or right. In order to get rid of such inconvenience we must correct the function onMove(e) inside the Fotorama library.

That file can be found here – MAGENTO_ROOT/lib/web/fotorama/fotorama.js
We should open it in editor, find the onMove(e) function (it is located on the line 1418), and change it with the new correct:

function onMove(e) {
if ((e.touches && e.touches.length > 1)
|| (MS_POINTER && !e.isPrimary)
|| moveEventType !== e.type
|| !touchEnabledFLAG) {
touchEnabledFLAG && onEnd();
(options.onTouchEnd || noop)();
return;
}

extendEvent(e);

var xDiff = Math.abs(e._x – startEvent._x), // opt _x → _pageX
yDiff = Math.abs(e._y – startEvent._y),
xyDiff = xDiff – yDiff,
xWin = (tail.go || tail.x || xyDiff >= 0) && !tail.noSwipe,
yWin = xyDiff < 0; if (touchFLAG && !tail.checked) { if (touchEnabledFLAG = xWin) { stopEvent(e); } } else { stopEvent(e); (options.onMove || noop).call(el, e, {touch: touchFLAG}); } if (!moved && Math.sqrt(Math.pow(xDiff, 2) + Math.pow(yDiff, 2)) > tolerance) {
moved = true;
}

tail.checked = tail.checked || xWin || yWin;
}

 

You may be interested in Website Themes for Magento from Developer

This entry was posted in Learning sessions and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *