为什么sort是jQuery UI .sortable()触发的唯一事件? [英] Why is sort the only event firing for jQuery UI .sortable()?

查看:414
本文介绍了为什么sort是jQuery UI .sortable()触发的唯一事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的代码示例@ http://jsbin.com/ukiwo3/edit

I have a simple code example @ http://jsbin.com/ukiwo3/edit

它有2个连接列表和一组绑定事件。我希望我错过了一些基于 http://jqueryui.com/demos/sortable/ 事件我认为当拖动和重新排序问题时,我应该看到所有这些事件被触发。目前只将日志排序到控制台。

It has 2 connected lists and a load of bound events. I'm hopeful I've missed something simple as based on http://jqueryui.com/demos/sortable/ Events I think I should see all these events fired when I drag and reorder a question li. At the moment only sort logs to the console.

谁能告诉我什么是错的以及如何让其他人解雇?

Can anyone tell me whats wrong and how to get the rest to fire?

谢谢,
Denis

Thanks, Denis

推荐答案

绑定时事件的命名方式不同,例如 sortstart 而不是 start 查看演示页面上的活动列表,查看您的绑定的完整列表应该是。

The events are named differently when binding, for example sortstart instead of start. Look at the list of events on the demo page for a full list of what your binds should be.

总的来说,它应该是这样的

$( ".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");
});

(未优化,仅显示事件名称)

(not optimized, just showing event names)

这篇关于为什么sort是jQuery UI .sortable()触发的唯一事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆