GithubHelp home page GithubHelp logo

stylish-select's Introduction

Stylish Select 0.4.1

A cross-browser, accessible alternative to the standard form element which can be fully customised with CSS

Stylish Select attempts to replicate the functionality of the browser default select box as closely as possible with support for keyboard navigation, and intelligent positioning.

Stylish Select aims to have a minimal code footprint and weighs in at just over 3KB when minified.

Get latest source code from GitHub

Usage

First, include the stylesheet, jQuery and the stylish select .js file in your html head tag

The plugin can be used to replace any select with the following:

$(document).ready(function(){  	$('#my-dropdown').sSelect();  });          

Simplest example, option selected by default

You can use the alphabetical and arrow keys to navigate the list as you would a browser default select.

Change event

Stylish Select alters the original select on the page, so you can access it's change event:

//change event  $('#my-dropdownChange').sSelect().change(function(){alert('changed')});              

Grouped options

Stylish Select supports optgroups.

Windows XP style

The Stylish Select can be styled with CSS in whatever way you like.

Getting/setting the value

//set value  $('#setVal').click(function(){  	$('#my-dropdown5').getSetSSValue('Sit');  });    //get value  $('#getVal').click(function(){  	alert('The value is: '+$('#my-dropdown5').getSetSSValue());  });              

Add new options to Stylish Select

//add options to select and update  $('#addOptions').click(function(){  	$('#my-dropdown6').append('').resetSS();  });              

If you add or remove options from the initial select element on the page, be sure to call the .resetSS() method on the select to update the Stylish Select replacement.

Max-height for large lists

$('#my-dropdown').sSelect({ddMaxHeight: '300px'});              

Intelligent positioning

Stylish Select will always remain visible on the page.

stylish-select's People

Contributors

shayzalman avatar

Watchers

 avatar

stylish-select's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.