[英]how do I move list elements in jQuery UI Sortable without the mouse, purely in jQuery?
I want to just set up a link that allows the user to jump a given sortable list element to the top of the list. 我想设置一个链接,允许用户将给定的可排序列表元素跳转到列表顶部。 I need something like 我需要类似的东西
$('.sortable li:last-child').move('.sortable li:first-child');
...where I can just cause a link to pop any list element up to the top of the list. ...我可以在其中生成一个链接,将任何列表元素弹出到列表顶部。
Never mind! 没关系! I found the answer. 我找到了答案。 $(id).prependTo($('#list')); $(ID).prependTo($( '#名单'));
Not sure if it's the best solution but this should work. 不确定它是否是最佳解决方案,但这应该有效。
$('.sortable li:last-child').live('click', function() {
$(this).prependTo('.sortable');
});
Kind of hard to help further without seeing more code. 没有看到更多代码,有点难以进一步帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.