问题描述
我想知道jQuery UI Selectable上是否有一个选项可以让我禁用 + Click,但仍保持可拖动状态以进行多重选择.在我的项目中,我希望人们能够选择多个,而只能通过拖动来选择,而不是通过 +单击来选择.
I was wondering if there is an option on the jQuery UI Selectable that will let me disable the +Click, but still keep the draggable for the multiple selection. On my project I want to be able for people to select multiples, but only by dragging, not by +clicking.
如果没有,没有人知道我可以实现这一目标的方法吗?
If there isn't, does anyone know a way I can achieve this?
任何信息都将非常有帮助! :)谢谢!!!
Any information would be really helpful! :) Thanks!!!
推荐答案
Selectable使用metaKey标志进行多选,因此您可以在调用selectable之前将metaKey绑定为false.然后, +单击将始终处于关闭状态.不过,在调用selectable之前,请确保绑定.
Selectable uses the metaKey flag to do multi-select, so you can bind metaKey to be false on the mousedown before calling selectable. Then +click will always be off. Make sure to bind before calling selectable though.
$('#selectable').bind("mousedown", function (e) {
e.metaKey = false;
}).selectable()
jsFiddle 此处
jsFiddle here
这篇关于禁用Ctrl并单击可选择的jQuery UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!