开发者

Animated transitions for jQuery UI's sortable

开发者 https://www.devze.com 2023-01-02 16:36 出处:网络
Just out of curiosity, as I haven\'t been able to find anything anywhere; does anyone know of a way to get jQuery UI\'s sortable function to animate its sorting?

Just out of curiosity, as I haven't been able to find anything anywhere; does anyone know of a way to get jQuery UI's sortable function to animate its sorting?

What I mean is, when you move an element around the sortable parent, its children, the sortables, skip around instead of smoothly animating to their new position, which besides from being an eyesore can also make it a bit difficult to figure out 开发者_如何学Cwhat has moved where.

There's obviously no default option for this, but I was hoping that perhaps someone, somewhere, had a neat solution.


Sadly it's not possible at the moment, as the sortable code just updates the position of the elements. Though it refers to an this.options.custom, which perhaps allows for custom animation; though it's then totally undocumented/unsupported:

if(this.options.custom && this.options.custom.refreshContainers) {
    this.options.custom.refreshContainers.call(this);
} else {
    for (var i = this.containers.length - 1; i >= 0; i--){
        var p = this.containers[i].element.offset();
        this.containers[i].containerCache.left = p.left;
        this.containers[i].containerCache.top = p.top;
        this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
        this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
    };
}

Sadly I can't be of much more help; Haven't divulged myself into the sortable code much, so above code extract might be misleading.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号