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:
Code:
<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):
Code:
var $targets=$('.magnify')
$targets.each(function(i){
var $target=$(this)
var options={}
if ($target.attr('data-magnifyto'))
options.magnifyto=parseFloat($target.attr('data-magnifyto'))
if ($target.attr('data-magnifyby'))
options.magnifyby=parseFloat($target.attr('data-magnifyby'))
if ($target.attr('data-magnifyduration'))
options.duration=parseInt($target.attr('data-magnifyduration'))
$target.imageMagnify(options)
})
With:
Code:
var mags = $('.magnify');
mags.each(function(){
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):
Code:
<img src="my.jpg" class="magnify" style="width:110px;height:55px;" />
But the magnifyto spec will be calculated and used automatically.
Bookmarks