What version of bootstrap 4 are you using and how have you loaded it into web pack? Using sass/css etc...?
Bootstrap 4 dropdown menu is not working.
Hi. I have a fresh Laravel 5.5. I have change the webpack and asset configurations to use Bootstrap v4.
Everything is working except the drop down menu for. It can't open the menu And I don't see any error as well. the webpack compiles everything successfully.
Here is the dropdown menu code that's not working.
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown link
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
Note : the collapse navigation is working just fine. means my javascript files are okay.
Thank's :)
I assume you're using booststrap v4 beta 1.
Bootstrap beta 1 switched to Popper.js for dropdowns, so you need to include that in your javascript mix.
Add window.Popper = require('popper.js').default; to your app.js, so it looks something like this:
(...)
try {
window.$ = window.jQuery = require('jquery');
window.Popper = require('popper.js').default;
require('bootstrap');
} catch (e) {}
(...)
Edit for posterity:
Make sure you install popper. npm install [email protected] --save
Please or to participate in this conversation.