Skip to content

Commit d6d306b

Browse files
author
Tom Doan
committed
Fix issue #25
1 parent 5fe13da commit d6d306b

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ If you don't use jQuery, then you can use [TrySound's vanilla JS version](https:
66

77
#### [See a demo &raquo;](http://thdoan.github.io/magnify/demo.html)<br>
88
#### [See a demo with mobile plugin &raquo;](http://thdoan.github.io/magnify/demo-mobile.html)
9+
#### [See a demo with an image map &raquo;](http://thdoan.github.io/magnify/demo-map.html)
910

1011
## Getting Started
1112

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "magnify",
33
"description": "A simple, lightweight jQuery magnifying glass zoom plugin.",
4-
"version": "1.6.11",
4+
"version": "1.6.12",
55
"main": [
66
"dist/css/magnify.css",
77
"dist/js/jquery.magnify.js"

dist/js/jquery.magnify.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery Magnify Plugin v1.6.11 by Tom Doan (http://thdoan.github.io/magnify/)
2+
* jQuery Magnify Plugin v1.6.12 by Tom Doan (http://thdoan.github.io/magnify/)
33
* Based on http://thecodeplayer.com/walkthrough/magnifying-glass-for-images-using-jquery-and-css3
44
*
55
* jQuery Magnify by Tom Doan is licensed under the MIT License.
@@ -154,6 +154,21 @@
154154
// Ensure lens is closed when tapping outside of it
155155
$('body').not($container).on('touchstart', hideLens);
156156

157+
// Image map needs to be on the same DOM level as image source
158+
// See https://github.com/jquery/jquery/issues/3364
159+
var sUsemap = $image.attr('usemap');
160+
if (sUsemap) {
161+
$image.after($('map[name=' + sUsemap.slice(1) + ']'));
162+
$container.one('click', function(e) {
163+
// Trigger click on image below lens at current cursor position
164+
$lens.hide();
165+
document.elementFromPoint(
166+
e.pageX || e.originalEvent.touches[0].pageX,
167+
e.pageY || e.originalEvent.touches[0].pageY
168+
).click();
169+
});
170+
}
171+
157172
if ($anchor.length) {
158173
// Make parent anchor inline-block to have correct dimensions
159174
$anchor.css('display', 'inline-block');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "magnify",
3-
"version": "1.6.11",
3+
"version": "1.6.12",
44
"description": "A simple, lightweight jQuery magnifying glass zoom plugin.",
55
"keywords": [
66
"jquery-plugin",

0 commit comments

Comments
 (0)