简体   繁体   English

使用jQuery在DIV中调整图像大小

[英]Resize Image inside DIV with Jquery

I need help with this situation... i´m trying to develop a banner rotator (full width), but i didn´t find any solution to strech/resize a slide image (indide a div) 100% width and maintain the aspect ratio. 在这种情况下,我需要帮助...我正在尝试开发横幅旋转器(全宽),但是我没有找到任何方法来拉伸或调整幻灯片图像的尺寸(包括div)100%的宽度并保持长宽比比。 I want to do it with jQuery... does anyone knows a JQuery plugin that solves this situation!! 我想用jQuery ...有谁知道解决这种情况的JQuery插件!

I Want something sililar of this , but applied to a class, because i don´t want this to all images!!! 我想要的东西sililar ,而是适用于一类,因为我不希望这所有的图像!

Please check below an example of my code. 请在下面查看我的代码示例。 Many thanks in advance!! 提前谢谢了!! :) :)

<!-- START BANNER WRAPPER -->
<div id="banner-wrapper">
<div id="banner-full-width">
<div id="main-slider">

  <div class="slide">
    <div class="image">
      <img src="" /> <!-- This is the image i want to fit inside of 100% width div -->
    </div>

    <div class="info">...</div>
  </div>

</div>
</div>
</div>
<!-- END BANNER WRAPPER -->

How about good ol' CSS? 好的CSS怎么样?

.image img {
    width:100%;
    height:auto;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM