JQuery UI - sort and drag speed

I have a problem with return speed.

Here is a working example http://www.jsfiddle.net/V9Euk/94/ <- updated

Change something in the sorted list ... the speed will be fast (return 100). But when you drop four into a sortable list, the speed is slow.

But why? oo

kind of reagards Peter

+3
source share
1 answer

There is nothing wrong with the code ... except that it was wrong. You had an incorrectly closed tag, and other oddities inside the code that were once cleared solved the problem. I think. If this is not what you asked for.

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Untitled Document</title>
    </head>

    <body>
        <ul id="k1" style="width:350px; height:350px; margin:20px;">
            <li>One</li>
            <li>Two</li>
            <li>Three</li>
        </ul>
        <hr />
        <ul style="width:350px; height:350px;">
            <li class="gt">Four</li>
        </ul>
    </body>
</html>

CSS:

body {
    font-size: 12px;
}

li{
    border:1px solid #444444;
    background-color:#AAAAAA;
    padding:10px;
    margin:10px;
}

JQuery

$("#k1").sortable({   revert: '100'  });
$('.gt').draggable({ connectToSortable: '#k1', revert: 'invalid', revertDuration: 100 });

: , . , . - , , .

var original = $('#k1');

original.sortable({ revert: 100  });
$('.gt').draggable({
    connectToSortable: original,
    revert: 'valid',
    revertDuration: 100,
    stop: function(event, ui) {
        original.sortable("option", "revert", 100);
    }
});

, div k1 .gt.

+8

Source: https://habr.com/ru/post/1759330/


All Articles