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

自古美人都是妖i 提交于 2019-12-03 14:31:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!