user1187968
user1187968

Reputation: 8006

Thumbnail image size for JSSOR (jQuery Plugin)

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>

Upvotes: 3

Views: 1082

Answers (2)

Tina Chen
Tina Chen

Reputation: 2030

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>

Upvotes: 0

jssor
jssor

Reputation: 6985

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>

Upvotes: 2

Related Questions