mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-30 00:33:55 +00:00
Deselect active element when mouse leaves suggestions container
This commit is contained in:
parent
56437a2ec5
commit
2afb5fc517
@ -141,6 +141,7 @@
|
||||
initialize: function () {
|
||||
var that = this,
|
||||
suggestionSelector = '.' + that.classes.suggestion,
|
||||
selected = that.classes.selected,
|
||||
container;
|
||||
|
||||
// Remove autocomplete attribute to prevent native suggestions:
|
||||
@ -169,6 +170,12 @@
|
||||
that.activate($(this).data('index'));
|
||||
});
|
||||
|
||||
// Deselect active element when mouse leaves suggestions container:
|
||||
container.on('mouseout', function() {
|
||||
that.selectedIndex = -1;
|
||||
container.children('.' + selected).removeClass(selected);
|
||||
});
|
||||
|
||||
// Listen for click event on suggestions list:
|
||||
container.on('click', suggestionSelector, function () {
|
||||
that.select($(this).data('index'));
|
||||
|
Loading…
Reference in New Issue
Block a user