简体   繁体   English

jQuery UI可排序不起作用

[英]Jquery UI sortable not working

I've been trying to get the sortable function to work, searched a lot of articles but so far no success. 我一直在尝试使sortable函数正常工作,搜索了很多文章,但到目前为止没有成功。

The basics are just get the simple ul to become sortable like the nice example on jqueryui.com The problem being, i'm doing everything as suggested but it's just ignoring me. 基础只是让简单的ul变得可排序,就像jqueryui.com上的漂亮示例一样。问题是,我按照建议进行了所有操作,但忽略了我。

here is what i currently have: http://jsfiddle.net/N63qQ/ 这是我目前拥有的: http : //jsfiddle.net/N63qQ/

html: HTML:

<ul id="sortable">
    <li id="item_1">bla</li>
    <li id="item_2">bla</li>
</ul>

js in the onload(and no onload is not in fact the problem) js中的onload(并且没有onload实际上不是问题)

$(function () {
    $('#sortable').droppable({
        tolerance: 'touch',
        drop: function () {
            alert('delete!');
        }
    });
    $('#item').sortable();
});

EDIT: ah got it, was using a wrong jquery ui lib 编辑:啊知道了,使用了错误的jQuery UI库

it should be sortable, not dropable. 它应该是可排序的,而不是可丢弃的。 Here is your code http://jsfiddle.net/N63qQ/4/ 这是您的代码http://jsfiddle.net/N63qQ/4/

$(function () {
$('#sortable').sortable({
    tolerance: 'touch',
    drop: function () {
        alert('delete!');
    }
});
$('#item').sortable();
});

You also forgot to include Jquery UI in your code 您还忘记了在代码中包含Jquery UI

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM