Nivo Slider: First image is scaled unproportional when displayed the first time
Asked Answered
D

2

6

I'm using the Nivo Slider jQuery Plugin in a div that has a smaller size then the images I'm displaying. When the Slider slides to the second image an on the images are scaled down correctly.

But when the first image is displayed for the first time (directly after loading the page), it is scaled only in width, but not in height. How can I change that?

Example: Let's say, all my images have a size of 1024*768 pixels. The div has a width of 400px. And I have 3 images in the slider.

  • directly after loading image 1 is displayed with 400*768 pixels (wrong)
  • then it slides to image 2 in 400*300 pixels
  • then to image 3 in 400*300 pixels
  • then to image 1 in 400*300 pixels (right)
  • ...

image 1 wrong image 2 right

EDIT: I just noticed, this only happens in IE, in Firefox there is no such error.

Dissection answered 14/2, 2013 at 10:25 Comment(2)
Hi! I can't scale down any of my images inside nivo-slider. Could you please write what settings you use? I have tried to add width and height to <img> tag, add css for it, etc. - I still get the cropped images. So, they are not scaled, just cropped.Synclastic
@Svetlana, don't set the size of the <img>, set the size for the outer <div>, then Nivo will resize the images to fit.Dissection
T
14

I had the same problem too - I added height: auto !important; to .nivo-main-image.

Tayyebeb answered 25/2, 2013 at 18:26 Comment(1)
Correction: with !important, the slider does not resize dynamically if the displayed pictures have different heights. I changed it against "height: auto;" without the !important, this still fixes the IE bug but also allows dynamical resizing.Dissection
C
1

In nivo-slider.css add

.nivoSlider { height:520px; }//specifies the height
Continental answered 7/5, 2013 at 21:51 Comment(1)
This would set a fix height ... what if I use more than one slider with more than one picture sizes? As I already commented on Cyndeed's answer: "height: auto;" fixed my problem.Dissection

© 2022 - 2024 — McMap. All rights reserved.