Skip to content

Commit 76b4c44

Browse files
author
isteven
committed
added touchstart event and some css updates
1 parent 2ef3dc3 commit 76b4c44

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

angular-multi-select.css

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
display: inline-block;
66
}
77

8-
/* multi select button style */
8+
/* button */
99
.multiSelect .button {
1010
display: block;
1111
position: relative;
1212
margin:0 auto;
1313
text-align: center;
1414
cursor: pointer;
1515
border: 1px solid #c6c6c6;
16-
padding: 7px 12px 5px;
16+
padding: 5px 8px 2px;
1717
font-size: 14px;
1818
line-height: 1.4;
1919
border-radius: 2px;
@@ -29,6 +29,7 @@
2929

3030
}
3131

32+
/* button on mouse hover */
3233
.multiSelect .button:hover {
3334
background-image: linear-gradient(#fff, #eee);
3435
}
@@ -51,6 +52,7 @@
5152
float: left;
5253
}
5354

55+
/* The checkboxes container */
5456
.multiSelect .checkboxLayer {
5557
background-color: #fff;
5658
position: absolute;
@@ -61,10 +63,11 @@
6163
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
6264
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
6365
background-clip: padding-box;
64-
padding: 15px;
66+
padding: 14px 0px 7px 14px;
6567
min-width:270px;
6668
}
6769

70+
/* Downward pointing arrow */
6871
.multiSelect .caret {
6972
display: inline-block;
7073
width: 0;
@@ -97,7 +100,6 @@
97100
min-width: 14px;
98101
}
99102

100-
101103
label.multiSelect span {
102104
white-space:nowrap;
103105
margin: 0;
@@ -137,15 +139,15 @@ label.multiSelect span {
137139
label.multiSelect input:focus ~ span::after,
138140
label.multiSelect span:focus::after,
139141
label.multiSelect span:hover::after {
140-
/* Enable this if you want some arrow pointer */
142+
/* Enable this if you want some arrow pointer on focus */
141143
/* content: ' \00AB'; */
142144
}
143145

144146
label.multiSelect input:focus ~ span,
145147
label.multiSelect span:hover {
146148
color: #333;
147149
cursor: pointer;
148-
/* Enable this if you want some arrow pointer */
150+
/* Enable this if you want some arrow pointer on focus */
149151
/* content: ' \00AB'; */
150152
}
151153

@@ -161,7 +163,9 @@ label.multiSelect span:hover {
161163
cursor: not-allowed;
162164
}
163165

164-
/* If you use images in button / checkbox label, you might want to change the image style here.. */
166+
/*
167+
* If you use images in button / checkbox label, you might want to change the image style here.
168+
*/
165169
.multiSelect img {
166170
vertical-align: middle;
167171
margin-bottom:3px;

angular-multi-select.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$
6464
'<button type="button" class="multiSelect button multiSelectButton" ng-click="toggleCheckboxes( $event ); refreshSelectedItems();" ng-bind-html="varButtonLabel" ng-focus="onFocus()" ng-blur="onBlur()">' +
6565
'</button>' +
6666
'<div class="multiSelect checkboxLayer hide">' +
67-
'<div class="multiSelect line">' +
67+
'<div class="multiSelect line" ng-show="displayHelper( \'all\' ) || displayHelper( \'none\' ) || displayHelper( \'reset\' )">' +
6868
'<span ng-if="!isDisabled && ( displayHelper( \'all\' ) || displayHelper( \'none\' ) || displayHelper( \'reset\' ))">Select: &nbsp;</span>' +
6969
'<button type="button" ng-click="select( \'all\' )" class="multiSelect helperButton" ng-if="!isDisabled && displayHelper( \'all\' )">All</button> ' +
7070
'<button type="button" ng-click="select( \'none\' )" class="multiSelect helperButton" ng-if="!isDisabled && displayHelper( \'none\' )">None</button> ' +
@@ -421,8 +421,8 @@ angular.module( 'multi-select', ['ng'] ).directive( 'multiSelect' , [ '$sce', '$
421421
$scope.isDisabled = newVal;
422422
});
423423

424-
// Monitor for clicks outside the button element to hide the checkboxes
425-
angular.element( document ).bind( 'click' , function( e ) {
424+
// Monitor for clicks or touches outside the button element to hide the checkboxes
425+
angular.element( document ).bind( 'click touchstart' , function( e ) {
426426
var checkboxes = document.querySelectorAll( '.checkboxLayer' );
427427
if ( e.target.className.indexOf( 'multiSelect' ) === -1 ) {
428428
for( i=0; i < checkboxes.length; i++ ) {

0 commit comments

Comments
 (0)