selectize.js - 如何禁用所选项目后闪烁的光标?

mik*_*ana 8 javascript jquery selectize.js

我正在使用selectize.js来设置文本框的样式,并且它工作正常.

$("select[name='somename']").selectize({
  valueField: 'id',
  labelField: 'name',
  searchField: 'name',
  options: selectableThings,
  render: {
    option: function(item, escape) {
      return render(someTemplate, item);
    },
    item: function(item, escape) {
      return render(someTemplate, item);
    }
  }
});
Run Code Online (Sandbox Code Playgroud)

但是我的项目范围有限,并且不希望始终启用光标(闪烁|).我搜索了API文档和源代码,但找不到任何明显的东西.

有内置的东西来禁用闪烁的光标吗?

编辑最初将此作为"禁用输入",但看起来光标不能用于输入(并且禁用输入仍然显示光标).

bri*_*vis 10

Selectize并不是专门设计为仅作为选择装饰者.光标来自<input>允许用户减少选项的元素.当用户键入时,隐藏输入将产生奇怪的行为.此外,当控件为空时,输入用于显示占位符文本.

从技术上讲,您可以使用CSS隐藏光标(和输入):

/* option a: make transparent */
.selectize-input input {
    color: transparent !important;
}

/* option b: position off-screen */
.selectize-input input {
    position: absolute !important;
    top: -9999px;
    left: -9999px;
}
Run Code Online (Sandbox Code Playgroud)

但同样,这会感觉很时髦.我将研究编写一个decorator_only禁用键盘处理的插件,但它并不是当前的优先事项.

http://jsfiddle.net/mARDE/1/