bootstrap-hover-dropdown icon indicating copy to clipboard operation
bootstrap-hover-dropdown copied to clipboard

Padding and margin prevents openDropdown event

Open webprogrammierer opened this issue 8 years ago • 0 comments

On my navbar anchor elements I have some padding and margin like this:

  .navbar-nav > li > a {
    padding-top: 16px;
    padding-bottom: 0px;
    padding-left: 5px;
    padding-right: 5px;
    margin-left: 8px;
    margin-right: 8px;
  }

This seems to be the reason why the openDropdown event is not called anymore in any cases: So you move your mouse over the menu items (hover) and sometimes the menu items open and sometimes they do not open.

The following code should be removed or improved to get the hover menu work proper also with padding and margin:

                // so a neighbor can't open the dropdown
                if(!$parent.hasClass('open') && !$this.is(event.target)) {
                    // stop this event, stop executing any code
                    // in this callback but continue to propagate
                    return true;
                }
                // 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)) {
                    // stop this event, stop executing any code
                    // in this callback but continue to propagate
                    return true;
                }

webprogrammierer avatar Jul 24 '17 23:07 webprogrammierer