jQuery 插件 Zelect

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-05 06:57:54

软件介绍

Zelect 是一个能够创建自定义 <select> 元素的 jQuery 插件。

特征:

  • 轻量

  • 没有 CSS

  • 可自定义

  • 异步分页加载大型选项列表 (read: AJAX-ready-and-enabled)

  • 再也个分离或隐藏的 DOM 节点初始化

  • 编程方式可选且多变

  • 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.")
}
Zelect – jQuery Plugin for Custom Select Elements

本文地址:https://codercto.com/soft/d/22688.html

The Mechanics of Web Handling

The Mechanics of Web Handling

David R. Roisum

This unique book covers many aspects of web handling for manufacturing, converting, and printing. The book is applicable to any web including paper, film, foil, nonwovens, and textiles. The Mech......一起来看看 《The Mechanics of Web Handling》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

html转js在线工具
html转js在线工具

html转js在线工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试