Skip to content

Commit 13362e3

Browse files
committed
Merge pull request #131 from Guy--L/master
Prevent dropdown from disappearing when mouse downed on scrollbar.
2 parents e9a37c0 + 2ad2820 commit 13362e3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

js/bootstrap-combobox.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,16 @@
136136
})
137137
.show();
138138

139+
$('.dropdown-menu').on('mousedown', $.proxy(this.scrollSafety, this));
140+
139141
this.shown = true;
140142
return this;
141143
}
142144

143145
, hide: function () {
144146
this.$menu.hide();
147+
$('.dropdown-menu').off('mousedown', $.proxy(this.scrollSafety, this));
148+
this.$element.on('blur', $.proxy(this.blur, this));
145149
this.shown = false;
146150
return this;
147151
}
@@ -254,6 +258,11 @@
254258
}
255259
}
256260

261+
, scrollSafety: function(e) {
262+
if (e.target.tagName == 'UL') {
263+
this.$element.off('blur');
264+
}
265+
}
257266
, clearElement: function () {
258267
this.$element.val('').focus();
259268
}

0 commit comments

Comments
 (0)