wduffy / jScroll

jScroll is a jQuery plugin that keeps an element in view when a user scrolls.
http://www.wduffy.co.uk/jScroll
73 stars 19 forks source link

Prevent Invalid Argument error in IE #1

Closed wezm closed 13 years ago

wezm commented 13 years ago

In my application $element.css("margin-top") was returning "auto" in IE, which causes parseInt to return NaN. Later on when that value is used as originalMargin within getMargin somewhere IE would raise an error. My change prevents the error by ensuring originalMargin is a number. I also pass the base (10) to parseInt to avoid any issues like this: http://stackoverflow.com/questions/850341/workarounds-for-javascript-parseint-octal-bug

wduffy commented 13 years ago

Thanks wez, nice clean fix. The Stack Overflow link was an interesting read as well.