forked from scottdarby/Stylish-Select
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6916f1a
commit 77c26bc
Showing
5 changed files
with
352 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,288 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<title>jQuery Stylish Select 0.4.1 plugin examples</title> | ||
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> | ||
<meta http-equiv="Content-Style-Type" content="text/css" /> | ||
|
||
<link rel="stylesheet" type="text/css" href="stylish-select.css" /> | ||
|
||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> | ||
<script src="jquery.stylish-select0.4.1.js" type="text/javascript"></script> | ||
|
||
<script type="text/javascript"> | ||
$(document).ready(function(){ | ||
|
||
$('#my-dropdown, #my-dropdown2, #my-dropdown3, #my-dropdown4, #my-dropdown5, #my-dropdown6').sSelect(); | ||
|
||
//set max height | ||
$('#my-dropdownCountries').sSelect({ddMaxHeight: '300px'}); | ||
|
||
//set value on click | ||
$('#setVal').click(function(){ | ||
$('#my-dropdown5').getSetSSValue('4'); | ||
}); | ||
|
||
//get value on click | ||
$('#getVal').click(function(){ | ||
alert('The value is: '+$('#my-dropdown5').getSetSSValue()); | ||
}); | ||
|
||
//alert change event | ||
$('#my-dropdownChange').sSelect().change(function(){alert('changed')}); | ||
|
||
//add options to select and update | ||
$('#addOptions').click(function(){ | ||
$('#my-dropdown6').append('<option value="newOpt">New Option</option>').resetSS(); | ||
}); | ||
|
||
}); | ||
</script> | ||
|
||
<style type="text/css"> | ||
body {font-family:Arial, Helvetica, sans-serif; font-size:12px;} | ||
.selCont {clear:both; margin-bottom:20px; padding-bottom:40px; float:left; border-bottom:dotted 1px #000; width:600px;} | ||
</style> | ||
|
||
</head> | ||
<body> | ||
<h1>Stylish Select 0.4.1</h1> | ||
<h2>A cross-browser, accessible alternative to the standard form element which can be fully customised with CSS</h2> | ||
<p>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.</p> | ||
<p>Stylish Select aims to have a minimal code footprint and weighs in at just over 3KB when minified.</p> | ||
<p><a href="http://www.scottdarby.com/2009/05/jquery-plugin-stylish-select-unobstrusive-select-box-replacement/">Stylish Select blog post</a></p> | ||
<p><a id="download" href="stylish-select.zip">Download source code (version 0.4.1)</a></p> | ||
<h2>Usage</h2> | ||
<p>First, include the stylesheet, jQuery and the stylish select .js file in your html head tag</p> | ||
<p>The plugin can be used to replace any select with the following:</p> | ||
<pre class="brush: javascript"> | ||
$(document).ready(function(){ | ||
$('#my-dropdown').sSelect(); | ||
}); | ||
</pre> | ||
<div class="selCont"> | ||
<h2>Simplest example, option selected by default</h2> | ||
<p>You can use the alphabetical and arrow keys to navigate the list as you would a browser default select.</p> | ||
<select id="my-dropdown" name="my-dropdown"> | ||
<option value="1">A cappella</option> | ||
<option value="test">Acid Jazz</option> | ||
<option value="3" selected="selected">Big Band</option> | ||
<option value="4">Big Beat</option> | ||
<option value="5">Cakewalk</option> | ||
<option value="6">Calenda</option> | ||
<option value="7">Dark ambient</option> | ||
<option value="8">Dark cabaret</option> | ||
</select> | ||
</div> | ||
<div class="selCont"> | ||
<h2>Change event</h2> | ||
<p>Stylish Select alters the original select on the page, so you can access it's change event:</p> | ||
<pre class="brush: javascript"> | ||
//change event | ||
$('#my-dropdownChange').sSelect().change(function(){alert('changed')}); | ||
</pre> | ||
<select id="my-dropdownChange" name="my-dropdown"> | ||
<option value="1">A cappella</option> | ||
<option value="test">Acid Jazz</option> | ||
<option value="3" selected="selected">Big Band</option> | ||
<option value="4">Big Beat</option> | ||
<option value="5">Cakewalk</option> | ||
<option value="6">Calenda</option> | ||
<option value="7">Dark ambient</option> | ||
<option value="8">Dark cabaret</option> | ||
</select> | ||
</div> | ||
<div class="selCont"> | ||
<h2>Grouped options</h2> | ||
<p>Stylish Select supports optgroups.</p> | ||
<select id="my-dropdown2" name="my-dropdown"> | ||
<optgroup label="Tool"> | ||
<option value="1">Opiate</option> | ||
<option value="2">Undertow</option> | ||
<option value="3">Aenima</option> | ||
<option value="4">Lateralus</option> | ||
</optgroup> | ||
<optgroup label="A Tribe Called Quest"> | ||
<option value="5">People's Instinctive Travels and the Paths of Rhythm</option> | ||
<option value="6">The Low End Theory</option> | ||
<option selected="7" value="mercedes">Midnight Marauders</option> | ||
<option value="8">Beats, Rhymes and Life</option> | ||
<option value="9">The Love Movement</option> | ||
</optgroup> | ||
</select> | ||
</div> | ||
<div id="win-xp" class="selCont"> | ||
<h2>Windows XP style</h2> | ||
<p>The Stylish Select can be styled with CSS in whatever way you like.</p> | ||
<select id="my-dropdown3" name="my-dropdown"> | ||
<option value="1">A cappella</option><option value="2">Acid Jazz</option> | ||
<option value="3" selected="selected">Big Band</option> | ||
<option value="4">Big Beat</option> | ||
<option value="5">Cakewalk</option> | ||
<option value="6">Calenda</option> | ||
<option value="7">Dark ambient</option> | ||
<option value="8">Dark cabaret</option> | ||
</select> | ||
</div> | ||
<div id="get-set" class="selCont"> | ||
<h2>Getting/setting the value</h2> | ||
<pre class="brush: javascript"> | ||
//set value | ||
$('#setVal').click(function(){ | ||
$('#my-dropdown5').getSetSSValue('Sit'); | ||
}); | ||
|
||
//get value | ||
$('#getVal').click(function(){ | ||
alert('The value is: '+$('#my-dropdown5').getSetSSValue()); | ||
}); | ||
</pre> | ||
<p><a id="setVal" href="javascript:void(0)">Set text to "Sit"</a></p> | ||
<p><a id="getVal" href="javascript:void(0)">Get value</a></p> | ||
<select id="my-dropdown5" name="my-dropdown"> | ||
<option value="1">Lorem</option> | ||
<option value="2">Ipsum</option> | ||
<option value="3">Dolor</option> | ||
<option value="4">Sit</option> | ||
<option value="5">Amet</option> | ||
<option value="6">Consectetuer</option> | ||
<option value="7">Adipiscing</option> | ||
</select> | ||
</div> | ||
<div id="update" class="selCont"> | ||
<h2>Add new options to Stylish Select</h2> | ||
<pre class="brush: javascript"> | ||
//add options to select and update | ||
$('#addOptions').click(function(){ | ||
$('#my-dropdown6').append('<option value="newOpt">New Option</option>').resetSS(); | ||
}); | ||
</pre> | ||
<p>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.</p> | ||
|
||
<p><a id="addOptions" href="javascript:void(0)">Add new options to select and update</a></p> | ||
<select id="my-dropdown6" name="my-dropdown"> | ||
<option value="1">Lorem</option> | ||
<option value="2">Ipsum</option> | ||
<option value="3">Dolor</option> | ||
<option value="4">Sit</option> | ||
<option value="5">Amet</option> | ||
<option value="6">Consectetuer</option> | ||
<option value="7">Adipiscing</option> | ||
<option value="7">Adipiscing</option> | ||
<option value="7">Adipiscing</option> | ||
<option value="7">Adipiscing</option> | ||
</select> | ||
</div> | ||
<div id="update" class="selCont"> | ||
<h2>Max-height for large lists</h2> | ||
<pre class="brush: javascript"> | ||
$('#my-dropdown').sSelect({{ddMaxHeight: '300px'}}); | ||
</pre> | ||
<select id="my-dropdownCountries" name="my-dropdown"> | ||
<option value="1">Afghanistan</option> | ||
<option value="1">Akrotiri</option> | ||
<option value="1">Albania</option> | ||
<option value="1">Algeria</option> | ||
<option value="1">American Samoa</option> | ||
<option value="1">Andorra</option> | ||
<option value="1">Angola</option> | ||
<option value="1">Anguilla</option> | ||
<option value="1">Antarctica</option> | ||
<option value="1">Antigua and Barbuda</option> | ||
<option value="1">Argentina</option> | ||
<option value="1">Armenia</option> | ||
<option value="1">Aruba</option> | ||
<option value="1">Ashmore and Cartier Islands</option> | ||
<option value="1">Australia</option> | ||
<option value="1">Austria</option> | ||
<option value="1">Azerbaijan</option> | ||
<option value="1">Bahamas, The</option> | ||
<option value="1">Bahrain</option> | ||
<option value="1">Bangladesh</option> | ||
<option value="1">Barbados</option> | ||
<option value="1">Bassas da India</option> | ||
<option value="1">Belarus</option> | ||
<option value="1">Belgium</option> | ||
<option value="1">Belize</option> | ||
<option value="1">Benin</option> | ||
<option value="1">Bermuda</option> | ||
<option value="1">Bhutan</option> | ||
<option value="1">Bolivia</option> | ||
<option value="1">Bosnia and Herzegovina</option> | ||
<option value="1">Botswana</option> | ||
<option value="1">Bouvet Island</option> | ||
<option value="1">Brazil</option> | ||
<option value="1">British Indian Ocean Territory</option> | ||
<option value="1">British Virgin Islands</option> | ||
<option value="1">Brunei</option> | ||
<option value="1">Bulgaria</option> | ||
<option value="1">Burkina Faso</option> | ||
<option value="1">Burma</option> | ||
<option value="1">Burundi</option> | ||
<option value="1">Cambodia</option> | ||
<option value="1">Cameroon</option> | ||
<option value="1">Canada</option> | ||
<option value="1">Cape Verde</option> | ||
<option value="1">Cayman Islands</option> | ||
<option value="1">Central African Republic</option> | ||
<option value="1">Chad</option> | ||
<option value="1">Chile</option> | ||
<option value="1">China</option> | ||
<option value="1">Christmas Island</option> | ||
<option value="1">Clipperton Island</option> | ||
<option value="1">Cocos (Keeling) Islands</option> | ||
<option value="1">Colombia</option> | ||
<option value="1">Comoros</option> | ||
<option value="1">Congo, Democratic Republic of the</option> | ||
<option value="1">Congo, Republic of the</option> | ||
<option value="1">Cook Islands</option> | ||
<option value="1">Coral Sea Islands</option> | ||
<option value="1">Costa Rica</option> | ||
<option value="1">Cote d'Ivoire</option> | ||
<option value="1">Croatia</option> | ||
<option value="1">Cuba</option> | ||
<option value="1">Cyprus</option> | ||
<option value="1">Czech Republic</option> | ||
<option value="1">Denmark</option> | ||
<option value="1">Dhekelia</option> | ||
<option value="1">Djibouti</option> | ||
<option value="1">Dominica</option> | ||
<option value="1">Dominican Republic</option> | ||
<option value="1">Ecuador</option> | ||
<option value="1">Egypt</option> | ||
<option value="1">El Salvador</option> | ||
<option value="1">Equatorial Guinea</option> | ||
<option value="1">Eritrea</option> | ||
<option value="1">Estonia</option> | ||
<option value="1">Ethiopia</option> | ||
<option value="1">Europa Island</option> | ||
<option value="1">Falkland Islands (Islas Malvinas)</option> | ||
<option value="1">Faroe Islands</option> | ||
<option value="1">Fiji</option> | ||
<option value="1">Finland</option> | ||
<option value="1">France</option> | ||
<option value="1">French Guiana</option> | ||
</select> | ||
</div> | ||
<div class="selCont"> | ||
<h2>Intelligent positioning</h2> | ||
<p>Stylish Select will always remain visible on the page.</p> | ||
<select id="my-dropdown4" name="my-dropdown"> | ||
<optgroup label="Tool"> | ||
<option value="1">Opiate</option> | ||
<option value="2">Undertow</option> | ||
<option value="3">Aenima</option> | ||
<option value="4">Lateralus</option> | ||
</optgroup> | ||
<optgroup label="A Tribe Called Quest"> | ||
<option value="5">People's Instinctive Travels and the Paths of Rhythm</option> | ||
<option value="6">The Low End Theory</option> | ||
<option selected="7" value="mercedes">Midnight Marauders</option> | ||
<option value="8">Beats, Rhymes and Life</option> | ||
<option value="9">The Love Movement</option> | ||
</optgroup> | ||
</select> | ||
</div> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.