Skip to content

Commit

Permalink
Merge pull request #55 from AnastasiaBuniakEPAM/JS-255
Browse files Browse the repository at this point in the history
JS-330: Hide magnifier on video images
  • Loading branch information
uharbachou1 committed Nov 27, 2015
2 parents 1b087f7 + e10f3e3 commit 5585249
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/web/magnifier/magnify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5585249

Please sign in to comment.