2014-03-19 106 views
3

我使用的是来自http://www.jssor.com/的jQuery图像滑块插件。 现在,插件需要滑块中缩略图的宽度和高度。JSSOR(jQuery插件)的缩略图大小

我不知道是否可以为每个图像设置不同的缩略图图像尺寸,因为我的图像尺寸与 不同,固定的宽度和高度会改变图像比例。

<div u="slides" style="cursor: move;"> 
      <div u="prototype" class="p" style="POSITION: absolute; WIDTH: 100px; HEIGHT: 50px; TOP: 0; LEFT: 0;"> 
       <div class="o" style="position:absolute;top:1px;left:1px;width:100px;height:50px;overflow:hidden;"> 
        <ThumbnailTemplate class="b" style="width:100px;height:50px; border: none;position:absolute; TOP: 0; LEFT: 0;"></ThumbnailTemplate> 
        <div class="i"></div> 
        <ThumbnailTemplate class="f" style="width:100px;height:50px;border: none;position:absolute; TOP: 0; LEFT: 0;"></ThumbnailTemplate> 
       </div> 
      </div> 
</div> 

回答

2

<div> 
    <img u="image" src="../img/alila/01.jpg" /> 
    <div u="thumb"> 
     <div style="width: 100%; height: 100%; background-image: url(../img/alila/thumb-01.jpg); background-position: center center; background-repeat: no-repeat; "> 
     </div> 
    </div> 
</div> 
0

更换

<div> 
    <img u="image" src="../img/alila/01.jpg" /> 
    <img u="thumb" src="../img/alila/thumb-01.jpg" /> 
</div> 

添加background-size: cover;background-size: contain;在第三格的基础上jssor的回答可以改变比率的风格。 这意味着:

<div> 
<img u="image" src="../img/alila/01.jpg" /> 
<div u="thumb"> 
    <div style="width: 100%; height: 100%; background-image: url(../img/alila/thumb-01.jpg); background-position: center center; background-repeat: no-repeat; "> 
</div> 
</div>