jquery - Odd ParseFloat Issue Javascript -
i have strange issue i'm encountering on ipad. seems other browsers can handle fine, have condition similar this:
if( parsefloat( $('#element1').css('opacity'),10).tofixed(2)!=usersetting1 || parsefloat( $('#element2').css('opacity'),10).tofixed(2)!=usersetting2 ){ return; }; ... rest of function
so, have couple of elements animate user action. prevent user continuously firing rest of function, i'm testing see if element has finished animating opacity. usersetting1 , 2 opacities user sets element1 , 2 animate respectively.
so, basically, if opacity hasn't reached user set opacity, drops out of function. works great everywhere ipad , it's based on issue parsefloat.
if user sets 0.15, 0.25, etc opacity setting, parsefloat(,10).tofixed(2) work , allow condition test properly.
however if user sets 1 or 0 opacity, screws up. apparently ipad doesn't think 1.0 = 1.
if there way around this?
ok, figured out. ipad seems animating element (say if usersetting1 0.15) 0.1503850384038439248. so, had run .tofixed(2) on both user setting , .css pull.
Comments
Post a Comment