Skip to content

Commit 8ac2558

Browse files
committed
version 1.0.5
1 parent 68d3b1e commit 8ac2558

4 files changed

+20
-16
lines changed

jquery.selectBox-tick.gif

-1.08 KB
Binary file not shown.

jquery.selectBox.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@
101101

102102
.selectBox-options LI A {
103103
line-height: 1.5;
104-
padding: 0 .3em 0 22px;
104+
padding: 0 .5em;
105105
white-space: nowrap;
106106
overflow: hidden;
107107
background: 6px center no-repeat;
108108
}
109109

110110
.selectBox-options LI.selectBox-hover A {
111-
background-color: #C8DEF4;
111+
background-color: #EEE;
112112
}
113113

114114
.selectBox-options LI.selectBox-disabled A {
@@ -117,7 +117,7 @@
117117
}
118118

119119
.selectBox-options LI.selectBox-selected A {
120-
background-image: url(jquery.selectBox-tick.gif);
120+
background-color: #C8DEF4;
121121
}
122122

123123
.selectBox-options .selectBox-optgroup {

jquery.selectBox.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
3-
jQuery selectBox (version 1.0.4)
3+
jQuery selectBox (version 1.0.5)
44
55
A cosmetic, styleable replacement for SELECT elements.
66
@@ -88,6 +88,10 @@
8888
- Added 'control' method for working directly with the selectBox control
8989
v1.0.3 (2011-04-22) - Fixed bug in value method that errored if the control didn't exist
9090
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
9195
9296
9397
Known Issues:
@@ -300,14 +304,11 @@ if(jQuery) (function($) {
300304
})
301305
.bind('mousedown.selectBox', function(event) {
302306
event.preventDefault(); // Prevent options from being "dragged"
307+
if( !select.selectBox('control').hasClass('selectBox-active') ) select.selectBox('control').focus();
303308
})
304309
.bind('mouseup.selectBox', function(event) {
305310
hideMenus();
306-
if( event.shiftKey ) {
307-
selectOption(select, $(this).parent(), true);
308-
} else {
309-
selectOption(select, $(this).parent(), false);
310-
}
311+
selectOption(select, $(this).parent(), event);
311312
});
312313

313314
disableSelection(options);
@@ -496,7 +497,7 @@ if(jQuery) (function($) {
496497
};
497498

498499

499-
var selectOption = function(select, li, selectRange) {
500+
var selectOption = function(select, li, event) {
500501

501502
select = $(select);
502503
li = $(li);
@@ -508,8 +509,8 @@ if(jQuery) (function($) {
508509

509510
if( select.attr('multiple') ) {
510511

511-
// If selectRange is true, this will select all options between li and the last li selected
512-
if( selectRange && control.data('selectBox-last-selected') ) {
512+
// If event.shiftKey is true, this will select all options between li and the last li selected
513+
if( event.shiftKey && control.data('selectBox-last-selected') ) {
513514

514515
li.toggleClass('selectBox-selected');
515516

@@ -528,8 +529,11 @@ if(jQuery) (function($) {
528529
affectedOptions.removeClass('selectBox-selected');
529530
}
530531

531-
} else {
532+
} else if( event.metaKey ) {
532533
li.toggleClass('selectBox-selected');
534+
} else {
535+
li.siblings().removeClass('selectBox-selected');
536+
li.addClass('selectBox-selected');
533537
}
534538

535539
} else {
@@ -639,7 +643,7 @@ if(jQuery) (function($) {
639643

640644
case 13: // enter
641645
if( control.hasClass('selectBox-menuShowing') ) {
642-
selectOption(select, options.find('LI.selectBox-hover:first'), event.shiftKey);
646+
selectOption(select, options.find('LI.selectBox-hover:first'), event);
643647
if( control.hasClass('selectBox-dropdown') ) hideMenus();
644648
} else {
645649
showMenu(select);

jquery.selectBox.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)