Skip to content

Commit 608ce75

Browse files
committed
v1.0.7
1 parent 285ece3 commit 608ce75

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

jquery.selectBox.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
3-
jQuery selectBox (version 1.0.6)
3+
jQuery selectBox (version 1.0.7)
44
55
A cosmetic, styleable replacement for SELECT elements.
66
@@ -93,7 +93,8 @@
9393
SHIFT like in normal browser controls
9494
- Fixed bug where inline controls would not receive focus unless tabbed into
9595
v1.0.6 (2011-04-29) - Fixed bug where inline controls could be "dragged" when selecting an empty area
96-
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
9798
9899
Known Issues:
99100
@@ -117,7 +118,7 @@ if(jQuery) (function($) {
117118
var init = function(select, data) {
118119

119120
// Disable for iOS devices (their native controls are more suitable for a touch device)
120-
if( navigator.userAgent.match(/iPad|iPhone/i) ) return false;
121+
if( navigator.userAgent.match(/iPad|iPhone|Android/i) ) return false;
121122

122123
// Element must be a select control
123124
if( select.tagName.toLowerCase() !== 'select' ) return false;
@@ -129,6 +130,7 @@ if(jQuery) (function($) {
129130
inline = select.attr('multiple') || parseInt(select.attr('size')) > 1;
130131

131132
var settings = data || {};
133+
if( settings.autoWidth === undefined ) settings.autoWidth = true;
132134

133135
// Inherit class names, style, and title attributes
134136
control
@@ -429,13 +431,16 @@ if(jQuery) (function($) {
429431

430432
hideMenus();
431433

432-
// Show menu
434+
// Auto-width
435+
if( settings.autoWidth ) options.css('width', control.outerWidth() - (parseInt(control.css('borderLeftWidth')) + parseInt(control.css('borderLeftWidth'))));
436+
437+
// Menu position
433438
options.css({
434-
width: control.outerWidth() - (parseInt(control.css('borderLeftWidth')) + parseInt(control.css('borderLeftWidth'))),
435439
top: control.offset().top + control.outerHeight() - (parseInt(control.css('borderBottomWidth'))),
436440
left: control.offset().left
437441
});
438442

443+
// Show menu
439444
switch( settings.menuTransition ) {
440445

441446
case 'fade':

0 commit comments

Comments
 (0)