`
thinktothings
  • 浏览: 782439 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

sexy-combo

阅读更多

转载:http://code.google.com/p/sexy-combo/

 

Sexy Combo jQuery plugin

 

Introduction

Sexy Combo is a jQuery plugin that replaces drop downs with a more usable and style-able version then the browser default. The plugin offers:

  • Skinned drop downs: A sexy default skin included, but modular code and smart CSS make it easy to style however you want.
  • Filtering select via typing: Start typing to narrow down a large list, rather then scrolling thru a huge list.
  • Lots of configuration options to tweak its behavior.
  • Support for multiple options

This project has stopped active development , but a fork of sexy-combo is in active development by one of the authors. See UFD; the Unobtrusive Fast-filter Dropdown , especially this UFD WhyTheFork wiki-page .

Installation

Please follow these instructions to install Sexy Combo:

  1. Download and unpack the archive.
  2. Include jQuery and plugin files to your web page:
<script

 

type

=

"text/javascript"

 

src

=

"path_to_plugin/lib/jquery-1.3.2.js"

></script>




<script

 

type

=

"text/javascript"

 

src

=

"path_to_plugin/lib/jquery.sexy-combo-2.1.2.js"

></script>



  1. Include core and skin CSS files to your page:
// core structure




<

link rel

=

"stylesheet"

 type

=

"text/css"

 href

=

"path_to_plugin/lib/sexy-combo.css"

 

/>




//sexy skin; substitute different skin here if desired




<

link rel

=

"stylesheet"

 type

=

"text/css"

 href

=

"path_to_plugin/skins/sexy/sexy.css"

>



  1. Done! Now make your selectboxes look and behave sexy! $("select").sexyCombo();

 

Usage and configuration options

 

Sexy Combo has a number of configuration options that are passed to the plugin in the form of JavaScript object, e.g. $("select").sexyCombo({triggerSelected: true}); . The full list of options is:

 

  • (string) skin - name of the skin that will be applied to the combobox. Default is "sexy"
  • (string) suffix - this option allows you to configure text input's name. The suffix will be appended to the name of the selectbox. Default is "sexyCombo".
  • (string) hiddenSuffix - the same as previous, but for the hidden input. Default is "sexyComboHidden".
  • (string) initialHiddenValue - the initial value of the hidden input of the combo. Default is "" (empty string).
  • (string) emptyText - if provided, will be shown when an empty text input has no focus.
  • (bool) autoFill - if true, user's input will be autofilled with the value of the first item of the dropdown list. Default is false.
  • (bool) triggerSelected - if true, the selected option of the selectbox will become the initial value of the combo. Default is false.
  • (function) filterFn - a filter function that determines which options should be in the dropdown list. This function takes two parameters - current text input value and dropdown list item's value, and should return true if item should be in the dropdown list, otherwise false. Default is null.
  • (bool) dropUp - if true, the dropdown list will appear above text input. Default is false.
  • (function) initCallback - function that is called at the end of constrictor. Default is null.
  • (function) initEventsCallback - function that is called at the end of initEvents method. Default is null.
  • (function) showListCallback - function that is called when the dropdown list appears. Default is null.
  • (function) hideListCallback - function that is called when the dropdown list disappears. Default is null.
  • (function) changeCallback - function that is called when both text and hidden inputs values are changed. Default is null.
  • (function) textChangeCallback - function that is called when text input's value is changed. Default is null.
Note that all callback functions are called in the scope of sexyCombo instance, so you have access to all of its methids / properties.

 

 

It is possible to create multiple comboboxes from which users can choose more than one option. All you need is to set "multiple" attribute of your selectbox to true, or set multiple autoFill config option. It will be fixed in one of the futute releases. config option to true if you create combo without selectbox. Currently this option does not work with

 

 

You are also able to create combos without using existing selectboxes. If you want to do this, you should use static method of jQuery.sexyCombo object named create , for example:
      $

.

sexyCombo

.

create

({


          id 

:

 

"id"

,


          name

:

 

"name"

,


          container

:

 

"#container"

,


          data

:

 

[


              

{

value

:

 

"1"

,

 text

:

 

"First option"

,

 selected

:

 

true

},


              

{

value

:

 

"2"

,

 text

:

 

"Second option"

},


              

{

value

:

 

"3"

,

 text

:

 

"Third option"

}


          

]


      

});


      



 

Below is the list of configuration options for static creating of comboboxes. You can pass them to the create method together with options we have discussed above.

 

 

  • (string) name - the name of the selectbox that will be created. Optional. Default is "" (empty string).
  • (string) id - the id of the selectbox that will be created. Optional. Default is "" (empty string)
  • (mixed) container - jQuery selector, jQuery object or DOM element that will hold the widget. Optional. Default is $(document) .
  • (array) data - data that contains information about combo's options. This is an array of objects, which should have three properties - value (value of the option) and text (text that is displayed for this option) and (optionally) selected (if set to true, option's "selected" attribute will be set to true. Makes sence only with triggerSelected config option set to true). This option is required.
  • (string) url - the URL of JSON object that contains data for combo's options. Object's format is the same as for data option. If specified, data option will be ignored.
  • (object) ajaxData - data that will be passed to AJAX request.
  • (bool) multiple - if true, the combobox will be multiple. Default is false.

Appearance customization

 

In this version I have separated core CSS and presentational CSS, so now it's possible to create new skins for Sexy Combo . The download package contains one example skin. Feel free to create your own based on it.

 

 

Browser compatibility

 

Sexy Combo has been tested and works on the following browsers:
  • Internet Explorer 6 (PC)
  • Internet Explorer 7 (PC)
  • Firefox 1.5 (Linux)
  • Firefox 2 (Linux)
  • Firefox 3 (PC)
  • Opera 9 (PC)

The developers welcome bug reports on any browser bug. Patches or code suggestions are also welcome.

Support project

 

Every user of Sexy Combo adds some value to it, so you help me by just using it. However, if you want to help more, you can do the following:

 

  • Tell the world about Sexy Combo . You can write an article or a blog post about it or just tell your friends/colleagues about it.
  • Test it on browsers that are not currently supported "officially".
  • Report a bug.
  • If you can contribute high quality fixes and improvements, join the devlopment here!
分享到:
评论

相关推荐

    sexy-lightbox-2.3_jQuery

    《jQuery插件:Sexy Lightbox 2.3详解》 Sexy Lightbox 2.3是一款基于jQuery库的轻量级图片弹出插件,它旨在为网页中的图像提供优雅、简洁的展示方式,使得用户在点击图片链接后,能够在一个全屏的、具有阴影效果的...

    可编辑的级联下拉列表框

    在实际开发中,"sexy-combo"可能是一个特定的插件或组件,用于创建美观且功能强大的可编辑级联下拉列表框。这个名称暗示了组件可能具有吸引人的视觉设计和良好的用户体验。使用这样的组件,开发者可以节省大量时间,...

    sexy-bash-prompt:具有颜色,git状态和git分支的bash提示

    你喜欢sexy-bash-prompt吗? 或 赞助商 成为赞助商,并在GitHub上的自述文件中获得您的徽标,并提供指向您网站的链接。 安装 一行安装(需要git , make ): (cd /tmp && ([[ -d sexy-bash-prompt ]] || git ...

    Hey-Sexy-Discord-Bot

    【标题】"Hey-Sexy-Discord-Bot" 是一个专门为Discord服务器设计的自定义漫游器,它的主要功能是为用户提供个性化的交互体验。这个漫游器的实现基于Python编程语言,展示了如何利用Python来开发Discord应用程序。 ...

    sexy-ceo:谁是世界上最性感的首席执行官?

    "sexy-ceo"项目就是一个专注于探索全球最性感CEO的平台,它通过网络技术将商业与娱乐元素巧妙结合,为公众提供了一个全新的视角来关注企业领导者。 这个项目采用JavaScript作为主要的开发语言,这表明了JavaScript...

    Thot-Downloader:sexy-egirls.com及更多-所有功能均在一个脚本中

    Thot下载器从sexy-egirls.com,forum.sexy-egirls.com,thotbook.tv,thots.tv,lewdweb.net下载。 在论坛中,单击“下载”按钮(下载外部嵌入式视频会花费一些时间)在“画廊”中,单击“将链接复制到剪贴板”按钮...

    linux-sexybashpromptBash提示包含着色gitstatuses和git分支

    `sexy-bash-prompt`是一个专为提升Linux终端体验设计的项目,它使得Bash提示符更加美观且功能丰富,特别适合Git用户。本项目的核心亮点在于它能显示彩色的Git状态信息,包括分支名和状态,使得开发者能够更直观地...

    Sexy Mouse - Ex_DUI扩展组件例子

    Sexy Mouse(性 感的鼠标),前几天看到大婶 @wangzexi 发了个 Sexy Coding (性 感的代码) ,他的是键盘输入时有例子爆炸效果,额 于是就弄了个鼠标点击的效果,当然比不上大婶的级别 不过也可以拿来玩玩,...

    sexy-commits:Sexy使用gitmoji.dev提交

    Sexy使用gitmoji.dev和Inquirer-autocomplete-prompt提交 Sexy使用package.json的配置提交。 在您的package.json和inquirer使用gitmoji映射配置来提示您所做的事情以及简短的解释(用作提交消息)。 { " gitmoji " :...

    javascript-is-sexy-quiz

    "JavaScript is Sexy Quiz"由Ricardo Gonzalez创建,旨在帮助开发者和学习者深入理解JavaScript的核心概念,提高编程技能。这个项目可能包含一系列的问题和挑战,旨在测试和巩固JavaScript的知识。 在JavaScript的...

    Sexy Comments插件 for Wordpress.zip

    http://wordpress.org/extend/plugins/sexy-comments/installation/ 替换原来的评论模板,让评论区域看起来有点像论坛的风格,确实相当Sexy。

    syncs-sexy-docker-containers:标题说明一切

    同步性感的docker容器 标题说了所有的宝贝。 该存储库包含用于以下目的的Dockerfile: naev-ubuntu1604(用于appimage版本构建,最古老的目标glibc平台) naev-ubuntu2004(用于CI和将来的版本。...

    Brexit 2 Sexy-crx插件

    让英国退欧性感 英国脱欧,令人沮丧。 这是解决方案,只是使其变得性感。 将其安装在您的chrome浏览器上,以使所有单词都出现英国脱欧,变得性感... 支持语言:English (UK)

    SexyEditor背景2

    【标题】"SexyEditor背景2"所指的是一款名为SexyEditor的编辑器的背景资源集。SexyEditor是一款专为开发者设计的代码编辑器,尤其针对Android Studio开发人员,它提供了个性化的界面定制功能,其中就包括了背景图片...

    sexy-table:漂亮HTML5表格不是表格

    性感表 ... 这个项目是我将要参与的一个即将到来的商业项目中使用的一个概念。 我一直在寻找像这样的客户端组件: 我想要一个可排序,可过滤,可搜索和可分页的表。... Dynatable最接近满足我的要求。...

    presentation-sexy-noise:我在2015年7月在Hootsuite进行的闪电演讲的幻灯片

    您好,我叫布兰登(Brandon),今天我要谈的是Noise,特别是Sexy Noise。 那么什么是性感噪音? 好吧,我指的是类似于许多自然现象的类似随机行为的产生。 树木的分布,海拔高度,水道等。性感噪声只是生成的看起来...

Global site tag (gtag.js) - Google Analytics