I have a div with width 600 px. I want to pull the images dynamically. Images size are varies. What I want to do is, if the image size is more than 600 px, we will resize the image to 600 px to fit into the div. But if the image is not more than 600px, we will leave as original image width.
How can i achieve that by using jquery ? Thanks.
You may be able to do this without any JavaScript by giving the image no explicit width (so it will use the original width) and adding the following CSS property:
<img style='max-width: 600px' src='...'>
Caveat: Doesn't work in IE 6. Compatibility table