JavaScript: Image doesn't scale in IE when dynamically added -
when dynamically add image div image doesn't scale when resize window in internet explorer.
i think it's more clear if show 2 simple examples:
the following example doesn't use javascript it's plain html , want.
http://www.friendly-stranger.com/halp/ie-width/index.html
the next 1 uses javascript , if resize width of browser window image doesn't scale width gets smaller.
http://www.friendly-stranger.com/halp/ie-width/bad.html
this screenshot of both examples: http://www.friendly-stranger.com/halp/ie-width/koala-squash.jpg
the javascript code use:
<script type="text/javascript"> $(function(){ var img = new image(); img.src = 'koala.jpg'; $('div').append(img); }); </script>
<script type="text/javascript"> $(function(){ var img = new image(); img.src = 'koala.jpg'; img.style.height = 'auto'; $('div').append(img); }); </script>
try this, hope it'll work
Comments
Post a Comment