问题
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)
- ...
EDIT: I just noticed, this only happens in IE, in Firefox there is no such error.
回答1:
I had the same problem too - I added height: auto !important;
to .nivo-main-image
.
回答2:
In nivo-slider.css add
.nivoSlider { height:520px; }//specifies the height
来源:https://stackoverflow.com/questions/14872634/nivo-slider-first-image-is-scaled-unproportional-when-displayed-the-first-time