[英]how can i sort elements on drop using JQuery UI?
I have few 'li'
elements. 我的
'li'
元素很少。 I can drag and drop elements...but,my requirement is i need to sort element after drop(element has to move to destination after mouse release). 我可以拖放元素...但是,我的要求是我需要在drop之后对元素进行排序(释放鼠标后元素必须移至目标位置)。 Please help me... Here is the code i'm using,
请帮助我...这是我正在使用的代码,
$( ".sortable" ).sortable({
revert: true,
start : function(e){
console.log(e);
}
});
$( "li selector" ).draggable({
connectToSortable: ".sortable",
start : function(e){
console.log(e);
}
});
Is there not a onDrop
event, or something similar you can listen for, to then run your sorting function? 是否没有
onDrop
事件或您可以听的类似事件然后运行排序功能?
If not, you could run a function that binds to the jQuery event .mouseup()
, which then fires your sorting function. 如果没有,您可以运行绑定到jQuery事件
.mouseup()
函数,然后触发您的排序函数。
https://api.jquery.com/mouseup/ https://api.jquery.com/mouseup/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.