Need to resize div according to image size before showing the image into it
<p>Suppose I have div with fixed height &amp; width. When user click on button then I want load image and put the image in div. Before putting the image into div I want to resize div height &amp; width according to image size with some smooth effect like <a href="http://visuallightbox.com/" rel="nofollow">http://visuallightbox.com/</a>.</p>

<p>When user click on any image there then a div appear and its height &amp; width gets bigger with smooth animation effect. So I want to do the same smooth div growing effect before showing the image into div....how to achieve it. plzz guide.</p>

<p>I know that how to resize div easily like...here is pseudo code:</p>

<pre><code>var h=$('#img1').height();
var w=$('#img1').width();
$('div.myGallery').css('width', w + 'px');
$('div.myGallery').css('height', h + 'px');
</code></pre>

<p>but the problem is that right logic is not coming to mind to show the div with growing effect like visual lightbox plug in. Please guide me with code....thanks</p>
