创建输入自动完成功能非常实用的脚本:At.js

jopen 9年前

创建自动完成功能非常实用的脚本:At.js
At.js - 非常实用的脚本用于创建输入自动完成功能 (使用 Emojify 的示例).

$('.atwho-inputor').atwho({    at: "@", data: ["one", "two", "three"],  });

还有一个库叫Typehead来自推ter也实现了同样功能。

特性

  • Support IE 7+ for textarea.
  • Supports HTML5 contentEditable elements (NOT include IE 8)
  • Can listen to any character and not just '@'. Can set up multiple listeners for different characters with different behavior and data
  • Listener events can be bound to multiple inputors.
  • Format returned data using templates
  • Keyboard controls in addition to mouse
    • Tab or Enter keys select the value
    • Up and Down navigate between values (and Ctrl-P and Ctrl-N also)
    • Right and left will re-search the keyword.
    </li>
  • Custom data handlers and template renderers using a group of configurable callbacks
  • Supports AMD
  • </ul>


     

    项目主页:http://www.open-open.com/lib/view/home/1416822141827