jQuery Chosen - 有没有办法在选择项目后让滚动框打开?

时间:2013-10-22 18:20:29

标签: jquery-chosen

我想知道我们是否可以在选择项目后打开滚动框。换句话说,如果我们按住CTRL键和选定的项目,则行为相同。

1 个答案:

答案 0 :(得分:0)

如果没有选择脚本修改,我认为不可能。

在jquery.chosen.js中查找类似的内容(第~95行):

if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
   this.results_hide();
}

根据您的需要修改它,可能是这样的:

添加名为stay_opened的新选项(第~155行):

this.stay_opened = this.options.stay_opened != null ? this.options.stay_opened : true;

修改上述代码:

if (!((evt.metaKey || evt.ctrlKey || this.stay_opened) && this.is_multiple)) {
    this.results_hide();
}

请注意,它仅适用于多种模式(但您也可以更改)。