Response title
This is preview!
var imgState = 'large';
var MaxWidth = 700;
var orgWidth;
var orgHeight;
var scaleWidth;
var scaleHeight;
$(document).ready(function(){
orgWidth = $("#showimage").width();
orgHeight = $("#showimage").height();
if(orgWidth > MaxWidth)
{
scaleWidth = MaxWidth;
scaleHeight = (MaxWidth/orgWidth)*orgHeight;
}
else
{
scaleWidth = orgWidth;
scaleHeight = orgHeight;
}
Resize('fast');
$("#showimage").click(function(){
Resize('slow');
});
});
function Resize(type)
{
if(imgState == 'small')
{
$("#showimage").animate({ height: orgHeight, width: orgWidth }, type);
$(".resizeDiv").hide(type);
imgState = 'large';
}
else
{
$("#showimage").animate({ height: scaleHeight, width: scaleWidth }, type);
$(".resizeDiv").show(type);
imgState = 'small';
}
}
Doomstone wrote:I think this have something to do with it getting the org image size before the image has loadet complety.
© 2013 jQuery Foundation
Sponsored by and others.