Ticket #4657 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 5 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 5 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 5 years ago by joern.zaefferer

  • Priority changed from minor to major
  • Summary changed from new sortable option: revertSpeed to Update docs, revert supports a number parameter for animation speed
  • Type changed from enhancement to bug
  • Version set to 1.7.2
  • Milestone changed from TBD to 1.8

Docs need to be updated.

comment:4 Changed 5 years ago by paul

  • Status changed from new to closed
  • Resolution set to fixed

Fixed!

Note: See TracTickets for help on using tickets.