Skip to content

Commit 6dadbb7

Browse files
committed
Fixed regression from 1.7.16 that occurred when the target option was passed a selector. Fixes jackmoore#113
1 parent ff6dd81 commit 6dadbb7

4 files changed

Lines changed: 11 additions & 10 deletions

File tree

jquery.zoom.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
Zoom 1.7.17
2+
Zoom 1.7.18
33
license: MIT
44
http://www.jacklmoore.com/zoom
55
*/
@@ -30,9 +30,8 @@
3030
$source = $(source);
3131

3232
// The parent element needs positioning so that the zoomed element can be correctly positioned within.
33-
$target.css('position', /(absolute|fixed)/.test(position) ? position : 'relative');
34-
$target.css('overflow', 'hidden');
35-
33+
target.style.position = /(absolute|fixed)/.test(position) ? position : 'relative';
34+
target.style.overflow = 'hidden';
3635
img.style.width = img.style.height = '';
3736

3837
$(img)
@@ -55,7 +54,7 @@
5554
targetWidth = $target.outerWidth();
5655
targetHeight = $target.outerHeight();
5756

58-
if (source === $target[0]) {
57+
if (source === target) {
5958
sourceWidth = targetWidth;
6059
sourceHeight = targetHeight;
6160
} else {
@@ -86,11 +85,10 @@
8685
var
8786
settings = $.extend({}, defaults, options || {}),
8887
//target will display the zoomed image
89-
target = settings.target || this,
88+
target = settings.target && $(settings.target)[0] || this,
9089
//source will provide zoom location info (thumbnail)
9190
source = this,
9291
$source = $(source),
93-
$target = $(target),
9492
img = document.createElement('img'),
9593
$img = $(img),
9694
mousemove = 'mousemove.zoom',

jquery.zoom.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jquery-zoom",
33
"description": "Enlarge images on click or mouseover.",
4-
"version": "1.7.17",
4+
"version": "1.7.18",
55
"keywords": [
66
"zoom",
77
"images",

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ To compile the .min.js file, run: `uglifyjs --comments '/license:/' < jquery.zoo
66

77
## Changelog:
88

9+
##### v1.7.18 - 2016/9/9
10+
* Fixed regression from 1.7.16 that occurred when the target option was passed a selector. Fixes #113
11+
912
##### v1.7.17 - 2016/9/7
1013
* Detect src using element.currentSrc to support srcset. Fixes #82
1114

0 commit comments

Comments
 (0)