View Full Version : Resolved jQuery Image Magnify v1.11

05-12-2012, 02:59 AM
1) Script Title: jQuery Image Magnify v1.11

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm

3) Describe problem:

Hello,..I want make image when zoom that is all natural in dimension with "width",.."height".
Can someone show me all "js" file and script for image.Please show me HTML example.

Sorry,..I have no link site.


05-12-2012, 03:53 AM
The simplest way is, since the default magnification is 3x, Set the image's dimensions on the page to one third of its natural dimensions.

For example, if your image's natural dimensions are 300 x 150, and it's called my.jpg:

<img src="my.jpg" class="magnify" style="width:100px; height:50px" />

05-12-2012, 05:54 AM
Thanks Mr.John.
But,..can you show me what need be change on "js" file?
Give me example and like that.
I am not looking for few picture dimension,..I am looking use this script for future for all picture in natural dimension.


05-12-2012, 04:32 PM
Oh, I was wrong, the simplest way is to use the data-magnifyto attribute set to the image's native width.

For example, if your image's natural dimensions are 300 x 150, and it's called my.jpg:

<img src="my.jpg" data-magnifyto="300" class="magnify" style="width:110px;width:55px;" />

In this manner, any image may be styled to appear on the page as any size, and will always magnify to its native dimensions.

But, if even that much is too much per image for you, in the jquery.magnifier.js file, using a text only editor like NotePad, replace (near the end):

var $targets=$('.magnify')
var $target=$(this)
var options={}
if ($target.attr('data-magnifyto'))
if ($target.attr('data-magnifyby'))
if ($target.attr('data-magnifyduration'))


var mags = $('.magnify');
var im = this;
$(new Image()).load(function(){
$(im).imageMagnify({magnifyto: this.width});
}).attr('src', im.src);

You still have to specify the on page width or height for the image (both is preferable I believe for some browsers):

<img src="my.jpg" class="magnify" style="width:110px;height:55px;" />

But the magnifyto spec will be calculated and used automatically.

05-12-2012, 10:01 PM
Wow,..that is working perfect.
Mr. John,..thank you very much.