Connecting a Draggable to Sortable causes helper element to jump

此生再无相见时 提交于 2019-12-01 20:50:55
Travis Russi

The primary cause of the jump was that the 'helper' option of the draggable was not set to 'clone'. If you use a clone helper, the jumping problem goes away.

If you need to use the 'original' helper setting, you will still have the jumping issue. One possible solution for it could be to use a custom helper option, as highlighted here: jQueryUI Draggable Helper Option Help. The idea would be to convert the position from relative to absolute at the time the helper is created.

Here's a link to the working demo using a 'clone' helper: http://jsfiddle.net/travisrussi/aBhDu/

It seems a custom helper function solves this problem, like this:

        $( ".draggable" ).draggable({
            connectToSortable: "#sortable",
            //helper: "original",
            revert: "invalid",
            helper: function() {
                return $(this);
            }
        });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!