Skip to content

Commit 5f9e2d6

Browse files
author
Tom Doan
committed
Only destroy images with zoom
1 parent f61e5ac commit 5f9e2d6

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

dist/js/jquery.magnify.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery Magnify Plugin v1.6.16 by T. H. Doan (http://thdoan.github.io/magnify/)
2+
* jQuery Magnify Plugin v1.6.17 by T. H. 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 T. H. Doan is licensed under the MIT License.
@@ -233,15 +233,14 @@
233233
this.destroy = function() {
234234
this.each(function() {
235235
var $this = $(this),
236-
$magnifyParent = $this.parent('.magnify'),
237-
sStyle = $this.data('originalStyle');
238-
if (sStyle) $this.attr('style', sStyle);
239-
else $this.removeAttr('style');
240-
241-
if($magnifyParent.length) {
242-
$magnifyParent.replaceWith($this);
243-
}
244-
$this.prevAll('.magnify-lens').remove();
236+
$lens = $this.prev('div.magnify-lens'),
237+
sStyle = $this.data('originalStyle');
238+
if ($this.parent('div.magnify').length && $lens.length) {
239+
if (sStyle) $this.attr('style', sStyle);
240+
else $this.removeAttr('style');
241+
$this.unwrap();
242+
$lens.remove();
243+
}
245244
});
246245
// Unregister event handler
247246
$(window).off('resize', refresh);

0 commit comments

Comments
 (0)