Skip to content

Padding and margin prevents openDropdown event #161

@webprogrammierer

Description

@webprogrammierer

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;
                }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions