npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kist-selectdown

v0.2.2

Published

Select with customizable menu.

Downloads

3,127

Readme

kist-selectdown

Select with customizable menu.

Installation

npm install kist-selectdown --save

bower install kist-selectdown --save

API

$Element.selectdown(options)

Returns: jQuery

options

Type: Object|String

Options defined as Object
classes

Type: Object

Classes for elements.

Default value:

{
	wrapper: 'kist-Selectdown',
	originalSelect: 'kist-Selectdown-originalSelect',
	select: 'kist-Selectdown-select',
	optionList: 'kist-Selectdown-optionList',
	optionItem: 'kist-Selectdown-optionItem',
	option: 'kist-Selectdown-option',
	isActive: 'is-active',
	isHidden: 'is-hidden',
	isFocused: 'is-focused'
}
templates

Type: Object

Template generating functions for custom markup.

Available values are:

| Name | Arguments | Description | | --- | --- | --- | | select | data | Template for select element. | | option | data | Template for option element. |

create

Type: Function
Arguments: [Select element, Custom select element]
Event: selectdowncreate

Callback to run on select menu creation (when DOM elements are ready).

open

Type: Function
Arguments: [Select element, Custom select element]
Event: selectdownopen

Callback to run when select menu is opened.

close

Type: Function
Arguments: [Select element, Custom select element]
Event: selectdownclose

Callback to run when select menu is closed.

select

Type: Function
Arguments: [Current replaced item, Current item value, Original option item]
Event: selectdownselect

Callback to run on option select.

Options defined as String

Type: String

destroy

Destroy plugin instance.

refresh

Refresh select menu (e.g. when changing content with html, append, …)

Examples

Default structure for select menu.

<select>
	<option value="1">Option 1</option>
	<option value="2">Option 2</option>
	<option value="3">Option 3</option>
</select>

Standard set of options.

$('select').selectdown();

Basic template support.

$('select').selectdown({
	templates: {
		item: function ( data ) {
			return '<strong><i>Item:</i> <u>' + data.value + '</u></strong>';
		}
	}
});

Callback on item select.

$('select').selectdown({
	select: function ( item, data ) {
		$(this).addClass('inputClass')
		item.addClass('itemClass');
		console.log(data);
	}
});

Refresh plugin instance.

$('select').html('<option value="42">Option 42</option>').selectdown('refresh');

Destroy plugin instance.

$('select').selectdown('destroy');

Testing

Currently, only manual tests are available.

Run npm test -- --watch and open http://0.0.0.0:8000/compiled/test/manual/ in your browser.

Browser support

Tested in IE8+ and all modern browsers.

License

MIT © Ivan Nikolić