0

jquery图片大小自适应

Posted in JavaScript at 十二月 2nd, 2009 / No Comments »

<style> img{     display:inline !important;     display:none;     max-width:100px;     border:0; } </style> </head> <body> <script type=”text/javascript”> function resizeImage(img,width){     var image=new Image();      image.src=img.src;      var temp = image.width;     img.width = temp = (temp>width)?width:temp;     img.style.display = “inline”; }  function doResize(){     if($.browser.version==6&&$.browser.msie) $(“img”).each(function(){resizeImage(this,100)}); } window.onload  = doResize; </script> <h1>CSS:max-width +JQuery js实现图片自适应大小</h1>     <a href=”0026.jpg” target=”_blank”><img src=”0026.jpg” /></a>     <a href=”0068.jpg” target=”_blank”><img src=”0068.jpg”  /></a>     <a href=”003.jpg” target=”_blank”><img src=”003.jpg” /></a>     <a href=”0053.jpg” target=”_blank”><img src=”0053.jpg” /></a>  </body>

No Responses to “jquery图片大小自适应”

Leave a Reply

请输入算式结果(看不清请点击图片)
(必须)