1
- ** Overview **
1
+ jQuery selectBox
2
2
3
- The plugin works by piggy-backing your existing SELECT controls. Since the original controls aren’t destroyed (they’re hidden), you can easily integrate this plugin into just about any existing form. The plugin degrades gracefully, as users without JavaScript will see the default SELECT controls .
3
+ A cosmetic, styleable replacement for SELECT elements .
4
4
5
+ Homepage: http://abeautifulsite.net/blog/2011/01/jquery-selectbox-plugin/
6
+ Demo: http://labs.abeautifulsite.dev/jquery-selectBox/
5
7
6
- ** Features **
8
+ Copyright 2012 Cory LaViska for A Beautiful Site, LLC.
9
+
10
+ Features:
7
11
8
12
- Supports OPTGROUPS
9
13
- Supports standard dropdown controls
@@ -16,17 +20,12 @@ The plugin works by piggy-backing your existing SELECT controls. Since the orig
16
20
- Tested in IE7-IE9, Firefox 3-4, recent webkit browsers, and Opera
17
21
18
22
19
- ** Demo **
20
-
21
- http://labs.abeautifulsite.dev/jquery-selectBox/
22
-
23
-
24
- ** License **
23
+ License:
25
24
26
25
Licensed under both the MIT license and the GNU GPLv2 (same as jQuery: http://jquery.org/license)
27
26
28
27
29
- ** Usage **
28
+ Usage:
30
29
31
30
Link to the JS file:
32
31
@@ -36,48 +35,76 @@ The plugin works by piggy-backing your existing SELECT controls. Since the orig
36
35
37
36
<link href="jquery.selectbox.min.css" rel="stylesheet" type="text/css" />
38
37
39
- ** To create **
40
-
41
- $("SELECT").selectBox([settings]);
42
-
43
-
44
- ** Settings **
45
-
46
- menuTransition: ['default', 'slide', 'fade']
47
- menuSpeed: [integer, 'slow', 'normal', 'fast']
48
-
49
-
50
- ** Methods **
51
-
52
- To call a method use this syntax:
53
-
54
- $("SELECT").selectBox('methodName', [options]);
55
-
56
- create - Creates the control (default method)
57
- destroy - Destroys the selectBox control and reverts back to the original form control
58
- disable - Disables the control (i.e. disabled="disabled")
59
- enable - Enables the control
60
- value - if passed with a value, sets the control to that value; otherwise returns the current value
61
- options - pass in either a string of HTML or a JSON object to replace the existing options
62
- control - returns the selectBox control element (an anchor tag) for working with directly
63
- refresh - syncs the UI control with the original contol's options
64
-
65
-
66
- ** Events **
38
+ To create:
67
39
68
- Events are fired on the original select element. You can bind events like this:
40
+ $("SELECT").selectBox([settings]);
69
41
70
- $("SELECT").selectBox().change( function() { alert( $(this).val() ); } );
71
-
72
- focus - Fired when the control gains focus
73
- blur - Fired when the control loses focus
74
- change - Fired when the value of a control changes
75
42
43
+ Settings:
44
+
45
+ To specify settings, use this syntax: $("SELECT").selectBox('settings', { settingName: value, ... });
46
+
47
+ menuTransition: ['default', 'slide', 'fade'] - the show/hide transition for dropdown menus
48
+ menuSpeed: [integer, 'slow', 'normal', 'fast'] - the show/hide transition speed
49
+ loopOptions: [boolean] - flag to allow arrow keys to loop through options
76
50
77
- ** Change Log **
78
51
79
- - Refer to jquery.selectBox.js for the full change log.
52
+ Methods:
53
+
54
+ To call a method use this syntax: $("SELECT").selectBox('methodName', [options]);
55
+
56
+ create - Creates the control (default method)
57
+ destroy - Destroys the selectBox control and reverts back to the original form control
58
+ disable - Disables the control (i.e. disabled="disabled")
59
+ enable - Enables the control
60
+ value - if passed with a value, sets the control to that value; otherwise returns the current value
61
+ options - pass in either a string of HTML or a JSON object to replace the existing options
62
+ control - returns the selectBox control element (an anchor tag) for working with directly
63
+ refresh - updates the selectBox control's options based on the original controls options
64
+
65
+
66
+ Events:
67
+
68
+ Events are fired on the original select element. You can bind events like this:
69
+
70
+ $("SELECT").selectBox().change( function() { alert( $(this).val() ); } );
80
71
81
- ** Known Issues **
72
+ focus - Fired when the control gains focus
73
+ blur - Fired when the control loses focus
74
+ change - Fired when the value of a control changes
75
+
76
+
77
+ Change Log:
78
+
79
+ v1.0.0 (2011-04-03) - Complete rewrite with added support for inline and multi-select controls
80
+ v1.0.1 (2011-04-04) - Fixed options method so it doesn't destroy/recreate the control when called.
81
+ - Added a check for iOS devices (their native controls are much better for
82
+ touch-based devices; you can still use selectBox API methods for theme)
83
+ - Fixed issue where IE window would lose focus on XP
84
+ - Fixed premature selection issue in Webkit browsers
85
+ v1.0.2 (2011-04-13) - Fixed auto-height for inline controls when control is invisible on load
86
+ - Removed auto-width for dropdown and inline controls; now relies 100% on CSS
87
+ for setting the width
88
+ - Added 'control' method for working directly with the selectBox control
89
+ v1.0.3 (2011-04-22) - Fixed bug in value method that errored if the control didn't exist
90
+ v1.0.4 (2011-04-22) - Fixed bug where controls without any options would render with incorrect heights
91
+ v1.0.5 (2011-04-22) - Removed 'tick' image in lieu of background colors to indicate selection
92
+ - Clicking no longer toggles selected/unselected in multi-selects; use CTRL/CMD and
93
+ SHIFT like in normal browser controls
94
+ - Fixed bug where inline controls would not receive focus unless tabbed into
95
+ v1.0.6 (2011-04-29) - Fixed bug where inline controls could be "dragged" when selecting an empty area
96
+ v1.0.7 (2011-05-18) - Expanded iOS check to include Android devices as well
97
+ - Added autoWidth option; set to false on init to use CSS widths for dropdown menus
98
+ v1.0.8 (2011-12-29) - Added refresh method (contributed by xjamundx)
99
+ - Hide menus when window is resized or scrolled (#9)
100
+ - Fixed autoWidth data issue (#13)
101
+ - SelectBox now gains focus when associated label is clicked
102
+ - Dropdown now inherits classes from original control (suffixed by -selectBox-dropdown-menu)
103
+ - Fixed meta/ctrl key issue (#41)
104
+ - Expanded iOS/Android check to include Windows 7 Phone and BlackBerry
105
+ v1.0.9 (2012-01-04) - Dropdown label class now syncs with selected option's class(es)
106
+
107
+
108
+ Known Issues:
82
109
83
110
- The blur and focus callbacks are not very reliable in IE7. The change callback works fine.
0 commit comments