Skip to content

Commit

Permalink
version 1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
claviska committed Apr 24, 2011
1 parent 68d3b1e commit 8ac2558
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
Binary file removed jquery.selectBox-tick.gif
Binary file not shown.
6 changes: 3 additions & 3 deletions jquery.selectBox.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@

.selectBox-options LI A {
line-height: 1.5;
padding: 0 .3em 0 22px;
padding: 0 .5em;
white-space: nowrap;
overflow: hidden;
background: 6px center no-repeat;
}

.selectBox-options LI.selectBox-hover A {
background-color: #C8DEF4;
background-color: #EEE;
}

.selectBox-options LI.selectBox-disabled A {
Expand All @@ -117,7 +117,7 @@
}

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

.selectBox-options .selectBox-optgroup {
Expand Down
26 changes: 15 additions & 11 deletions jquery.selectBox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
jQuery selectBox (version 1.0.4)
jQuery selectBox (version 1.0.5)
A cosmetic, styleable replacement for SELECT elements.
Expand Down Expand Up @@ -88,6 +88,10 @@
- Added 'control' method for working directly with the selectBox control
v1.0.3 (2011-04-22) - Fixed bug in value method that errored if the control didn't exist
v1.0.4 (2011-04-22) - Fixed bug where controls without any options would render with incorrect heights
v1.0.5 (2011-04-22) - Removed 'tick' image in lieu of background colors to indicate selection
- Clicking no longer toggles selected/unselected in multi-selects; use CTRL/CMD and
SHIFT like in normal browser controls
- Fixed bug where inline controls would not receive focus unless tabbed into
Known Issues:
Expand Down Expand Up @@ -300,14 +304,11 @@ if(jQuery) (function($) {
})
.bind('mousedown.selectBox', function(event) {
event.preventDefault(); // Prevent options from being "dragged"
if( !select.selectBox('control').hasClass('selectBox-active') ) select.selectBox('control').focus();
})
.bind('mouseup.selectBox', function(event) {
hideMenus();
if( event.shiftKey ) {
selectOption(select, $(this).parent(), true);
} else {
selectOption(select, $(this).parent(), false);
}
selectOption(select, $(this).parent(), event);
});

disableSelection(options);
Expand Down Expand Up @@ -496,7 +497,7 @@ if(jQuery) (function($) {
};


var selectOption = function(select, li, selectRange) {
var selectOption = function(select, li, event) {

select = $(select);
li = $(li);
Expand All @@ -508,8 +509,8 @@ if(jQuery) (function($) {

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

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

li.toggleClass('selectBox-selected');

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

} else {
} else if( event.metaKey ) {
li.toggleClass('selectBox-selected');
} else {
li.siblings().removeClass('selectBox-selected');
li.addClass('selectBox-selected');
}

} else {
Expand Down Expand Up @@ -639,7 +643,7 @@ if(jQuery) (function($) {

case 13: // enter
if( control.hasClass('selectBox-menuShowing') ) {
selectOption(select, options.find('LI.selectBox-hover:first'), event.shiftKey);
selectOption(select, options.find('LI.selectBox-hover:first'), event);
if( control.hasClass('selectBox-dropdown') ) hideMenus();
} else {
showMenu(select);
Expand Down
4 changes: 2 additions & 2 deletions jquery.selectBox.min.js

Large diffs are not rendered by default.

0 comments on commit 8ac2558

Please sign in to comment.