#10193 closed bug (invalid)
animate from width:0px to width:100% causing exception
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | misc | Version: | 1.6.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In function animate there is following code:
if (unit !== "px") { jQuery.style(self, name, (end || 1) + unit); start = ((end || 1) / e.cur()) * start; jQuery.style(self, name, start + unit); }
Should probably check if e.cur() is zero.
}
Change History (2)
comment:1 Changed 11 years ago by
Component: | unfiled → misc |
---|---|
Priority: | undecided → low |
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 10 years ago by
I experienced the same problem (with opacity).
The missing simple zero-check prevents some animations to start from the correct start value.
As far as I can see even jQuery.fx.prototype.step cant handle this because "now" and "start" stay NaN, so it isn't handled! I.e. the jQuery.fx.prototype.step.opacity (at line 8823, 1.7.1) receives "NaN" in parameter fx.now!
BTW: What should this line actually do? Should it take another animation in account? Then why not just do
start = e.cur();
?
Here are 2 test cases: Fade out: http://jsfiddle.net/M9WLL/1/ (works) Fade in: http://jsfiddle.net/VVNrN/3/ (doesn't work - style.opacity value equals end-value during whole animation!) You can even try to use start values other than 0 - doesn't work either.
Please apply the supposed check and these blurry edge-cases are gone and it just works!
Thanks for the suggestion. If you take a look through the jQuery source, you'll see that this is handled appropriately in jQuery.fx when calling e.cur();