我有一个简单的代码示例@http://jsbin.com/ukiwo3/edit为什么排序是jQuery UI .sortable()的唯一触发事件?
它有2个连接列表和一个绑定事件的负载。我很希望我已经错过了一些简单的事情,基于http://jqueryui.com/demos/sortable/事件我想我应该看到所有这些事件发生时,我拖动和重新排序问题李。此刻只将日志排序到控制台。
任何人都可以告诉我什么是错的,以及如何让其余的火?
感谢, 丹尼斯
我有一个简单的代码示例@http://jsbin.com/ukiwo3/edit为什么排序是jQuery UI .sortable()的唯一触发事件?
它有2个连接列表和一个绑定事件的负载。我很希望我已经错过了一些简单的事情,基于http://jqueryui.com/demos/sortable/事件我想我应该看到所有这些事件发生时,我拖动和重新排序问题李。此刻只将日志排序到控制台。
任何人都可以告诉我什么是错的,以及如何让其余的火?
感谢, 丹尼斯
绑定时事件命名有所不同,例如sortstart
而不是start
。 Look at the list of events on the demo page了解您的绑定应该是什么的完整列表。
总体而言,it should look like this:
$(".questions").bind("sortstop", function(event, ui) {
console.log("stop event");
});
$(".questions").bind("sortstart", function(event, ui) {
console.log("start event");
});
$(".questions").bind("sortchange", function(event, ui) {
console.log("change event");
});
$(".questions").bind("sort", function(event, ui) {
console.log("sort event");
});
$(".questions").bind("sortremove", function(event, ui) {
console.log("remove event");
});
$(".questions").bind("sortout", function(event, ui) {
console.log("out event");
});
$(".questions").bind("sortover", function(event, ui) {
console.log("over event");
});
$(".questions").bind("sortupdate", function(event, ui) {
console.log("update event");
});
(不优化,只是显示事件名称)
我知道我只需要第二双眼睛!应该自己发现它。干杯 – 2010-12-17 03:01:39
@Denis - 欢迎光临! :) – 2010-12-17 03:03:56
我这样做,我看到停止事件被触发:
$('.questions').sortable({
axis: 'y',
connectWith: ".questions",
placeholder: "question-highlight",
stop:function(event, ui) {
console.log("stop event");
}
});
在我看来,这些“事件”是无法通过bind
访问。
http://docs.jquery.com/UI/Sortable#events - 点击这里,查看绑定的例子。 – 2010-12-17 02:56:25