Search and Top Navigation
#6637 closed bug (fixed)
Opened November 09, 2010 03:13AM UTC
Closed November 09, 2010 01:39PM UTC
Last modified December 08, 2010 06:37PM UTC
Slide effect is jumpy with certain parameter combinations
Reported by: | Jeff Roush | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.8.7 |
Component: | ui.effects.* (individual effect) | Version: | 1.8.6 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
An example of the bug is at: http://jsbin.com/equwu4/2/
When showing an element using the slide effect, if the direction parameter is 'left' or 'up', and the distance parameter is a non-number CSS position, like "75%", or "75px", instead of a pure number, the animation runs but starts at the wrong location and jumps when it's done. When the direction is 'right' or 'down', or the distance is a pure number, the animation is smooth.
The animation should be smooth for all valid parameter combinations.
To reproduce:
First, run the slide effect to the left, with a distance parameter that is not a simple number:
jqobj.effect('slide', {direction: 'left', mode: 'hide', distance: '75%'}, 2000);
And once the hiding is finished, call
jqobj.effect('slide', {direction: 'left', mode: 'show', distance: '75%'}, 2000);
I have a fix:
Changing line 32 of jquery.effects.slide.js from
if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); Shift
to
if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? '-' + distance : -distance) : distance); Shift
adds an isNaN check for distance. With this change, the animation runs smoothly.
Fixed in 412d1aa.