Skip to content

Commit

Permalink
Get magnific plugin working
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidIQ committed Feb 5, 2017
1 parent 252399c commit 7765511
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions styles/all/js/reimg.js
@@ -1,6 +1,6 @@
/**
* Resize too large images
* (c) DavidIQ 2010-2016
* (c) DavidIQ 2010-2017
* http://www.davidiq.com/
**/

Expand Down Expand Up @@ -66,19 +66,27 @@ function ReIMG(altLabels, settings) {
returnFocus: false,
maxWidth: $window.width(),
maxHeight: $window.height(),
onComplete: function () {
onComplete: function() {
//reimg.ZoomMoreAdd("img.cboxPhoto");
}
});

break;

case "_magnific": //Use Magnific Popup plugin
//TODO: Configure properly
$(imageSelector).magnificPopup({
type: 'image',
verticalFit: true,
cursor: null
cursor: null,
gallery: {
enabled: true,
navigateByImgClick: true
},
callbacks: {
open: function() {
//reimg.ZoomMoreAdd('img.mfp-img');
}
}
});

break;
Expand Down Expand Up @@ -211,7 +219,7 @@ function ReIMG(altLabels, settings) {
positiontop = $image.css('top'),
$reimgClicked = $('<div/>', {id: 'ReIMG-Clicked'});

if (reimg.Settings.zoomMethod != '_colorbox') {
if (reimg.Settings.zoomMethod != '_colorbox' && reimg.Settings.zoomMethod != '_magnific') {
$reimgClicked.css({
'width': $image.css('width'),
'height': $image.css('height'),
Expand Down Expand Up @@ -257,9 +265,22 @@ function ReIMG(altLabels, settings) {

reimg.ZoomMoreClick = function (e, zoomButton)
{
var imageIdentifier = '#ReIMG-Clicked img.ReIMG-Anchor';

switch (reimg.Settings.zoomMethod)
{
case '_colorbox':
imageIdentifier = 'img.cboxPhoto';
break;

case '_magnific':
imageIdentifier = 'img.mfp-img';
break;
}

var $zoomBtn = $(zoomButton),
$zoomImg = $zoomBtn.find('span'),
$image = $(reimg.Settings.zoomMethod != '_colorbox' ? '#ReIMG-Clicked img.ReIMG-Anchor' : 'img.cboxPhoto'),
$image = $(imageIdentifier),
reimgheight = '',
reimgwidth = '',
imgposition = 'fixed',
Expand Down

0 comments on commit 7765511

Please sign in to comment.