Abhishek Dhote
Abhishek Dhote

Reputation: 1648

JQuery image slider having issue with image width & height

I am using image slider specified at: here

My images are of different sizes and I want to set the width and height of the image using following code:

<img src='77.png' width="20px" height="20px" />

But this doesnt work.

I am preety new to javascript, any help will be greatly approciated!

Upvotes: 3

Views: 5709

Answers (4)

Jamie
Jamie

Reputation: 1014

Please post your complete HTML/JS source code, the image size shouldn't matter as long as they are the same height/width as the container of the slideshow. Chances are you are possibly calling the plugin in the wrong way in your JS.

Upvotes: 0

bondythegreat
bondythegreat

Reputation: 1409

put this in your css :

    .cs-coin-slider
    {
    /*i think the class name is depend on what you set*/ 
        -o-background-size: 20px 20px;
        -webkit-background-size: 20px 20px;
        -khtml-background-size: 20px 20px;
        -moz-background-size: 20px 20px;
        background-size: 20px 20px;
    }

if you insist to use this coin-slider, no matter you set the size in html or set the css width+height of the image, it wont resized because this plugin treats the image as background..and that css3 background resize that is the only way that save you :)

Upvotes: 2

ScottS
ScottS

Reputation: 72261

I really don't think this code can handle it (perhaps with a very serious overhaul of the javascript). I set up a fiddle here: http://jsfiddle.net/JLjCP/9/ and in examining what it is doing, it simply does not care what size the image itself is nor does it care if you have resized the image explicitly through the width and height properties. It is only taking the referenced image file and using it as a repositioned background image for the split components which are purely sized by the width and height of the display and the number of sections you tell it to do it in.

So the short answer is this code will not do what you want it to do.

Upvotes: 4

JJJ
JJJ

Reputation: 33163

The documentation on that page says that you can pass size options to the constructor:

$('#coin-slider').coinslider({ width: 20, height: 20 });

If you have different sized images in the same slideshow and you want to change the slider's size dynamically, it might not be possible. Use same sized images or tweak the CSS so that you get black bars around smaller images or something to that effect.

Upvotes: 0

Related Questions