diff --git a/bootstrap-hover-dropdown.js b/bootstrap-hover-dropdown.js index b1f5902..58f23d2 100644 --- a/bootstrap-hover-dropdown.js +++ b/bootstrap-hover-dropdown.js @@ -53,6 +53,7 @@ openDropdown(event); }, function () { + if ( isCollapsed() ){ return; } timeout = window.setTimeout(function () { $parent.removeClass('open'); $this.trigger(hideEvent); @@ -90,6 +91,8 @@ }); function openDropdown(event) { + if ( isCollapsed() ){ return; } + $allDropdowns.find(':focus').blur(); if(settings.instantlyCloseOthers === true) @@ -99,6 +102,12 @@ $parent.addClass('open'); $this.trigger(showEvent); } + + function isCollapsed() { + if ( ($(".navbar-toggle").filter(":visible").length ) && ($this.parents('.navbar-collapse').length) ){//prevent acting on navbar in collapsed mode + return true; + } + } }); };