vendor/assets/javascripts/hoverdown.js in flashgrid-2.1.2 vs vendor/assets/javascripts/hoverdown.js in flashgrid-2.2.0
- old
+ new
@@ -32,28 +32,39 @@
settings = $.extend(true, {}, defaults, options, data),
timeout;
$parent.hover(function (event) {
// so a neighbor can't open the dropdown
- if(!$parent.hasClass('open') && !$this.is(event.target)) {
+ if($parent.hasClass('open') && !$this.is(event.target)) {
// stop this event, stop executing any code
// in this callback but continue to propagate
return true;
}
+ window.clearTimeout(timeout);
openDropdown(event);
}, function () {
timeout = window.setTimeout(function () {
$parent.removeClass('open');
$this.trigger(hideEvent);
}, settings.delay);
});
+ // clear timeout if hovering submenu
+ $allDropdowns.find('.dropdown-menu').hover(function(){
+ window.clearTimeout(timeout);
+ }, function(){
+ timeout = window.setTimeout(function () {
+ $parent.removeClass('open');
+ $this.trigger(hideEvent);
+ }, settings.delay);
+ });
+
// this helps with button groups!
$this.hover(function (event) {
// this helps prevent a double event from firing.
// see https://github.com/CWSpear/bootstrap-hover-dropdown/issues/55
- if(!$parent.hasClass('open') && !$parent.is(event.target)) {
+ if($parent.hasClass('open') && !$parent.is(event.target)) {
// stop this event, stop executing any code
// in this callback but continue to propagate
return true;
}
\ No newline at end of file