louisremi / background-size-polyfill

Adds support for background-size "cover" and "contain" to IE8
http://louisremi.github.com/background-size-polyfill/
MIT License
1.26k stars 359 forks source link

Line: 182 Error: Invalid argument. #11

Closed mraible closed 11 years ago

mraible commented 11 years ago

I'm using Bootstrap's Tabs feature to show different images on each tab. For some reason, imgRatio is NaN on line 177, so the following line fails with "Invalid argument".

img.style.left = delta + "px";

Changing this line to the following seems to fix the problem.

if (!isNaN(delta)) {
    img.style.left = delta + "px";
}
frebro commented 11 years ago

I'm seeing the same error on line 182 and line 220 when using FlexSlider. The reason seems to be that the image does not have a dimension yet. I can confirm that 2e487298606dc125228e339c73fc82ea88a7b590 fixes this.

jefferyto commented 11 years ago

This should be fixed in 0.2.0. Please reopen (or file a new ticket) if the issue reappears - thanks :-)