diff --git a/lib/web/magnifier/magnify.js b/lib/web/magnifier/magnify.js index be4f20b6f17f7..4ad719cd5d0d7 100644 --- a/lib/web/magnifier/magnify.js +++ b/lib/web/magnifier/magnify.js @@ -24,7 +24,9 @@ define([ zoomOutLoaded = 'zoom-out-loaded', zoomInDisabled = 'fotorama__zoom-in--disabled', zoomOutDisabled = 'fotorama__zoom-out--disabled', + videoContainerClass = 'fotorama-video-container', hideMagnifier, + checkForVideo, behaveOnHover, dragFlag, endX, @@ -736,6 +738,13 @@ define([ $(magnifierZoomSelector).remove(); }; + /** + * Check for video container. + */ + checkForVideo = function ($stageFrame) { + return $stageFrame.hasClass(videoContainerClass); + }; + /** * Hides magnifier on drag and while arrow click. */ @@ -785,10 +794,13 @@ define([ }); $(element).on('fotorama:load fotorama:showend fotorama:fullscreenexit fotorama:ready', function (e, fotorama) { - hideMagnifier(); - config.magnifierOpts.large = $(gallerySelector).data('fotorama').activeFrame.img; - config.magnifierOpts.full = fotorama.data[fotorama.activeIndex].original; - $($(gallerySelector).data('fotorama').activeFrame.$stageFrame).magnify(config.magnifierOpts); + var $activeStageFrame = $(gallerySelector).data('fotorama').activeFrame.$stageFrame; + if (!$activeStageFrame.find(magnifierZoomSelector).length) { + hideMagnifier(); + config.magnifierOpts.large = $(gallerySelector).data('fotorama').activeFrame.img; + config.magnifierOpts.full = fotorama.data[fotorama.activeIndex].original; + !checkForVideo($activeStageFrame) && $($activeStageFrame).magnify(config.magnifierOpts); + } }); $(element).on('gallery:loaded', function (e) { var $prevImage;