Skip to content

Commit 6fdd83f

Browse files
committed
Merge pull request #71 from ValeryYafremau/JS-356
JS-356: Add preview arrows while video is playing (for better navigation)
2 parents c592174 + 210289c commit 6fdd83f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/web/mage/gallery/gallery.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,10 @@
874874
transition-property: none;
875875
}
876876
}
877+
iframe {
878+
width: calc(~'100% - @{fotorama-arw-size} * 2');
879+
left: @fotorama-arw-size;
880+
}
877881
}
878882
}
879883

lib/web/magnifier/magnify.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,22 @@ define([
807807
});
808808
}
809809

810+
/**
811+
* Displays navigation arrows on preview if it contains ifraime.
812+
* @param fotorama - object of fotorama
813+
*/
814+
function showArrows (fotorama) {
815+
var $arrows = $('[data-gallery-role="arrow"]');
816+
817+
if ((fotorama.activeFrame.$stageFrame.find(':has(iframe)').length && fotorama.fullScreen) ||
818+
(fotorama.fullScreen && config.fullscreen.arrows) ||
819+
(!fotorama.fullScreen && config.arrows)) {
820+
$arrows.show();
821+
} else {
822+
$arrows.hide();
823+
}
824+
};
825+
810826
$.extend(config.magnifierOpts, {
811827
zoomable: false,
812828
thumb: '.fotorama__img',
@@ -836,6 +852,7 @@ define([
836852
!checkForVideo($activeStageFrame) && $($activeStageFrame).magnify(config.magnifierOpts);
837853
}
838854
});
855+
839856
$(element).on('gallery:loaded', function (e) {
840857
var $prevImage;
841858
$(element).find(gallerySelector)
@@ -888,6 +905,7 @@ define([
888905
resetVars($(fullscreenImageSelector));
889906
magnifierFullscreen(fotorama);
890907
mousewheel(e, fotorama, element);
908+
showArrows(fotorama);
891909

892910
if ($prevImage) {
893911
calculateMinSize($prevImage);

0 commit comments

Comments
 (0)