<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Zelect創(chuàng)建 select 元素的 jQuery 插件

          聯(lián)合創(chuàng)作 · 2023-10-02 17:10

          Zelect 是一個能夠創(chuàng)建自定義 <select> 元素的 jQuery 插件。

          特征:

          • 輕量

          • 沒有 CSS

          • 可自定義

          • 異步分頁加載大型選項列表 (read: AJAX-ready-and-enabled)

          • 再也個分離或隱藏的 DOM 節(jié)點初始化

          • 編程方式可選且多變

          • Unit-tested

          代碼示例:
          $('select').on('ready', function() { $('form').enable() })
          $('select').on('change', function(evt, item) { $('form input.id-container').val(item.id) })
          $('select').zelect({
            throttle: 150,
            placeholder: $('<i>').text('Which one...'),
            loader: loader,
            renderItem: renderer,
            noResults: noResultser
          }
          
          function loader(term, page, callback) {
            $.get('/q', { q:term, p:page }).then(function(items) {
              var result = _(items).map(function(item) {
                return { text:item.content, img:item.imageUrl || 'default.png', id:item.uniqueId }
              }
              callback(result)
            }
          }
          
          function renderer(item, term) {
            return $('<div>')
              .append($('<img>').attr('src', item.img))
              .append($('<span>').addClass('content').text(item.label))
          }
          
          function noResultser(term) {
            return $('<span>').addClass('no-results').text(term + "didn't hit anything.")
          }
          瀏覽 14
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  五月天淫淫网 | 国产99久久九九精品无码免费 | 在线免费亚洲视频 | 天天干天天色天天曹 | 成年人毛片国产网站国产片 |