3

I am using the jQuery image slider plugin from http://www.jssor.com/. Right now, the plugin require a width and height for the thumbnails in the slider.

I wonder can I set the thumbnail image size for each image differently, because I have image with different size, a fixed width and height will change the image ratio.

<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>
user1187968
  • 7,154
  • 16
  • 81
  • 152

2 Answers2

2

Please replace

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

with

<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>
jssor
  • 6,995
  • 2
  • 18
  • 21
0

Add background-size: cover; or background-size: contain; in the style of third div based on jssor's answer can change the ratio. which means:

<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>

Tina Chen
  • 2,010
  • 5
  • 41
  • 73