New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navbar dropdown menus not working outside of getbootstrap.com page #24227
Comments
You're missing the JS that's required for the dropdowns. See the https://getbootstrap.com homepage for the CDN links to jQuery, Popper, and Bootstrap's JS file. |
Thanks. My setups can't include the JavaScript stuff since it conflicts with Angular, so the JavaScript imports are easy to forget. Since there are no ng-bootstrap examples for navbar and the dropdown examples at https://ng-bootstrap.github.io/#/components/dropdown/examples don't include a navbar example, here is some navbar with dropdown code that seems to work for ng-bootstrap with Bootstrap 4 beta (and without the JavaScript imports):
|
The navbar docs include an example :). Edit: Oh sorry, that's for Angular. Carry on then! <3 |
Thanks a lot @MickeySegal ! Seems a bit strange that you have to use ng-bootstrap stuff in Angular applications. Nevertheless here is a solution with working hamburger icon as well: https://stackoverflow.com/a/46883241/1820522 |
Take the pooper.min.js from the bootstrap site and not from pooper site and that work for me ! |
The dropdown menu code in the Navbar in bootstrap/4.0.0-beta shows unexpected variability depending on the environment.
Running the dropdown code from https://getbootstrap.com/docs/4.0/components/navbar/ the dropdown works fine.
However, when the same code is put on another page with the Bootstrap starter template code, the dropdown doesn't work and the browser only goes off to example.com. This is illustrated at http://plnkr.co/edit/TbnlswWCKxoGIi7uLRS6?p=preview (may need to widen the preview menu for components to show up).
It is not clear which behavior is correct, but the variation in different environments seems surprising.
I see the same behavior on Windows 10 in Chrome, Firefox and Edge, all with latest release versions.
There seems to be some other dependence from what is described in the setup instructions. I've seen the same lack of functioning of the dropdown in other more complicated situations. If there are other factors to specify to get the dropdown to work they should be made more clear.
The text was updated successfully, but these errors were encountered: