diff options
author | lou <louiscuny@gmail.com> | 2014-07-16 17:59:52 +0200 |
---|---|---|
committer | lou <louiscuny@gmail.com> | 2014-07-16 17:59:52 +0200 |
commit | 96630a904d5705af837e16d526289d979f8af063 (patch) | |
tree | c04c15ab67c6f744762836f67e4d8d1b2fbe81b6 /js | |
parent | 058c212f09cf70079cf2a6e48d4cc5c4412a2a73 (diff) | |
download | multi-select-96630a904d5705af837e16d526289d979f8af063.zip multi-select-96630a904d5705af837e16d526289d979f8af063.tar.gz multi-select-96630a904d5705af837e16d526289d979f8af063.tar.bz2 |
fix hover on lists
Diffstat (limited to 'js')
-rw-r--r-- | js/jquery.multi-select.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/js/jquery.multi-select.js b/js/jquery.multi-select.js index 3bdfb2b..878cf46 100644 --- a/js/jquery.multi-select.js +++ b/js/jquery.multi-select.js @@ -313,6 +313,7 @@ 'switchList' : function($list){ $list.blur(); + this.$container.find(this.elemsSelector).removeClass('ms-hover'); if ($list.parent().hasClass('ms-selectable')){ this.$selectionUl.focus(); } else { @@ -322,16 +323,10 @@ 'activeMouse' : function($list){ var that = this; - var lastMovedDom = false; - $list.on('mousemove', function(){ - if (lastMovedDom === this) return; - lastMovedDom = this; - var elems = $list.find(that.elemsSelector); - - elems.on('mouseenter', function(){ - elems.removeClass('ms-hover'); - $(this).addClass('ms-hover'); - }); + + $('body').on('mouseenter', that.elemsSelector, function(){ + $(this).parents('.ms-container').find(that.elemsSelector).removeClass('ms-hover'); + $(this).addClass('ms-hover'); }); }, @@ -364,8 +359,11 @@ if (selectables.length > 0){ selectables.addClass('ms-selected').hide(); selections.addClass('ms-selected').show(); + options.prop('selected', true); + that.$container.find(that.elemsSelector).removeClass('ms-hover'); + var selectableOptgroups = that.$selectableUl.children('.ms-optgroup-container'); if (selectableOptgroups.length > 0){ selectableOptgroups.each(function(){ @@ -414,6 +412,8 @@ selections.removeClass('ms-selected').hide(); options.prop('selected', false); + that.$container.find(that.elemsSelector).removeClass('ms-hover'); + var selectableOptgroups = that.$selectableUl.children('.ms-optgroup-container'); if (selectableOptgroups.length > 0){ selectableOptgroups.each(function(){ |