diff --git a/dist/js/jquery.magnify.js b/dist/js/jquery.magnify.js index 50d355c..b76add6 100644 --- a/dist/js/jquery.magnify.js +++ b/dist/js/jquery.magnify.js @@ -1,5 +1,5 @@ /*! - * jQuery Magnify Plugin v2.3.0 by T. H. Doan (https://thdoan.github.io/magnify/) + * jQuery Magnify Plugin v2.3.2 by T. H. Doan (https://thdoan.github.io/magnify/) * Based on http://thecodeplayer.com/walkthrough/magnifying-glass-for-images-using-jquery-and-css3 * * jQuery Magnify by T. H. Doan is licensed under the MIT License. @@ -71,6 +71,65 @@ if ($lens.is(':visible')) $lens.fadeOut(oOptions['speed'], function() { $html.removeClass('magnifying').trigger('magnifyend'); // Reset overflow-x }); + }, + moveLens = function(e) { + e.preventDefault(); + // Reinitialize if image initially hidden + if (!nImageHeight) { + refresh(); + return; + } + // x/y coordinates of the mouse pointer or touch point. This is the position of + // .magnify relative to the document. + // + // We deduct the positions of .magnify from the mouse or touch positions relative to + // the document to get the mouse or touch positions relative to the container. + nX = (e.pageX || e.originalEvent.touches[0].pageX) - oContainerOffset['left'], + nY = ((e.pageY || e.originalEvent.touches[0].pageY) - oContainerOffset['top']) - oOptions['touchBottomOffset']; + // Toggle magnifying lens + if (!$lens.is(':animated')) { + if (nX>nBoundX && nXnBoundY && nY0) nRatioX = 0; + else if (nRatioX0) nRatioY = 0; + else if (nRatioY