Codeinwp / Nivo-Slider-jQuery

Nivo Slider - The Most Awesome jQuery Image Slider
http://docs.themeisle.com/article/485-getting-started-with-the-nivo-slider-jquery-plugin
MIT License
1.25k stars 605 forks source link

IE 8/9 First image stretched in a responsive layout (fix proposed) #347

Open dannyfreire76 opened 11 years ago

dannyfreire76 commented 11 years ago

There's a small bug with the height of the first slide when you place the slider in a responsive layout and the image height is constrained by its container. The image appears stretched out because when IE sets the first background, it mistakenly copies over the height and width attributes of the image as it would appear on its own (even if the dimensions are not specified in the original image itself), which in turn sets the slider's overall height.

The fix is to explicitly remove the width and height attributes on line 78 of the unpacked file:

sliderImg.attr('src', vars.currentImage.attr('src')).removeAttr('width').removeAttr('height').show();

waldensystems commented 11 years ago

I can confirm this is happening. In IE7&8, Chrome Version 26.0.1410.43 m, and FireFox 19 it works fine.

In IE9 & 10, the slider image(s) in a responsive layout is the correct width but the height does not adjust. When using developer tools in IE if I resize the developer tool height the slider height seems to realize what its correct height should be and it is fixed, but not on reload of course.

Dannyfreire76's fix corrected this issue for me. I just wish I knew a better way of making the change than editing the source so I don't forget or miss my notes when it comes time to updating nivoslider and cause issues.

jaylinski commented 11 years ago

i can also confirm this issue. only appears in internet explorer. firefox and chrome work fine. here's a workaround: http://stackoverflow.com/questions/14872634/nivo-slider-first-image-is-scaled-unproportional-when-displayed-the-first-time add "height: auto;" to the ".nivo-main-image" class.

dennisderoo commented 11 years ago

i can also confirm this issue. @jaylinski height: auto; fix did the trick for me.