創建輸入自動完成功能非常實用的腳本:At.js

jopen 10年前發布 | 32K 次閱讀 At.js JavaScript開發工具包

創建自動完成功能非常實用的腳本: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.
    • </ul> </li>

    • Custom data handlers and template renderers using a group of configurable callbacks
    • Supports AMD
    • </ul>


       

      項目主頁:http://www.baiduhome.net/lib/view/home/1416822141827

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!