Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#4657 closed bug (fixed)

Update docs, revert supports a number parameter for animation speed

Reported by: crankharder Owned by:
Priority: major Milestone: 1.8
Component: ui.sortable Version: 1.7.2
Keywords: revert Cc:
Blocked by: Blocking:

Description

Should be self-explanatory:

I'd like to be able to control how fast an option reverts back to its position.

Should act like other jquery speed settings, slow, normal, fast (i think?) or an integer which represents milliseconds.

Change History (4)

comment:1 Changed 14 years ago by crankharder

I tracked this down to the animate() function inside of sortable here:

$(this.helper).animate({

left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)

}, parseInt(this.options.revert, 10)
500, function() {

self._clear(event);

});

The second param is: parseInt(this.options.revert, 10)
500, which is the duration of the animation... I'm not sure what the parseInt part is trying to do, but if I replace that whole thing with a custom speed then I get the result I want. I don't think this can be set by some external option as of right now -- maybe it can??

comment:2 Changed 14 years ago by crankharder

Okay -- the docs explicitly state that revert takes a boolean, and the examples show true/false being passed in:

http://docs.jquery.com/UI/API/1.7/Sortable#option-revert

Based on the code above, taken from 1.7.2 that revert actually will take a number and convert that to the animation speed.

Passing revert:100 as an option confirms it as well.

I've no idea if tests support this, but it seems to work in practice... Maybe somebody should update the docs to reflect that?

comment:3 Changed 14 years ago by Jörn Zaefferer

Milestone: TBD1.8
Priority: minormajor
Summary: new sortable option: revertSpeedUpdate docs, revert supports a number parameter for animation speed
Type: enhancementbug
Version: 1.7.2

Docs need to be updated.

comment:4 Changed 14 years ago by paul

Resolution: fixed
Status: newclosed

Fixed!

Note: See TracTickets for help on using tickets.