iamphill / Bootstrap-Offcanvas

:zap: Offcanvas menu built with Bootstrap
MIT License
368 stars 111 forks source link

Dropdowns don't open in desktop view #60

Closed winmodify closed 6 years ago

winmodify commented 7 years ago

Dropdown menu's don't open when you click on them in desktop view. In mobile view it works perfectly.

vadim-p commented 7 years ago

Same issue. It conflicts with bootstrap's dropdown because of e.stopPropagation() call in OffcanvasDropdown. _clickEvent method. And I wondered why that class exists at all :)

fstockel commented 7 years ago

I can into the same issue and managed to solve it (or make it work) by explicitly adding a display attribute in my css declaration for the shown class on the dropdown-menu:

.navbar-offcanvas .dropdown-menu.shown { display:inline-block; }

ChrisInv commented 7 years ago

Thanks for this @fstockel. Problem is the dropdown won't close when clicking away. And if you have multiple dropdowns, then clicking on one won't close the other if it's already open.

Anyone got a solution for this scenario?

jer0dh commented 7 years ago

@ChrisInv the workaround provided by @fstockel worked for me. My dropdowns close when I click on another dropdown.

scrapewww commented 7 years ago

This works for me, although clicking outside the menu does not close the menu which is kind of sketchy imo.

simpletheoryco commented 6 years ago

@ChrisInv @scrapewww I'm having the same issue of dropdowns not closing when clicking away (outside the navbar, anywhere else on the page). Have you guys figured this out?

simpletheoryco commented 6 years ago

Nevermind, I found a fix. Jame's answer worked for me.

https://stackoverflow.com/questions/22528892/jquery-add-active-class-and-remove-active-from-other-element-on-click

balajidharma commented 6 years ago

Try below fix - Created pull request #75

         e.stopPropagation();
          $('.dropdown-toggle').not(this.element).closest('.active').removeClass('active').find('.dropdown-menu').removeClass('shown');
          this.dropdown.toggleClass("shown");
 -        return this.element.parent().toggleClass('active');
 +        return this.element.parent().toggleClass('open');
        };
iamphill commented 6 years ago

https://github.com/iamphill/Bootstrap-Offcanvas/pull/75 was merged