marufalom
6 months ago

Bootstrap Nav-Menu is not opening

Posted 6 months ago by marufalom

Tried other solutions in this forum no luck.

webpack.mix.js

mix.webpackConfig(webpack => {
    return {
        plugins: [
            new webpack.ProvidePlugin({
                $: "jquery",
                jQuery: "jquery",
                "window.jQuery": "jquery",
                Popper: ["popper.js", "default"],
            })
        ]
    };
});



mix.setPublicPath(path.resolve("./"))
mix.copy('mix-manifest.json', 'public/mix-manifest.json');

mix.js("resources/assets/js/app.js", "dist/js/app.js")
    .js("resources/assets/js/index.js", "dist/js/modules.js")
   .sass("resources/assets/sass/app.scss", "dist/css/app.css")
    .sourceMaps()

bootstrap.js

try {
    window.$ = window.jQuery = require('jquery');
    window.Popper = require('popper.js').default;
    require('bootstrap');
} catch (e) {
    console.log('Doesnt work')
}

navbar.blade.php

<ul class="nav-right">
            <li>
                <a href="{{ route('ChangeLang',['lang' => LaravelLocalization::getCurrentLocale() == 'en' ? 'th' : 'en']) }}">
                    <i class="ti-flag"></i> {{ LaravelLocalization::getCurrentLocale() == 'en' ? 'ไทย' : 'English'  }}
                </a>
            </li>
            <li class="dropdown">
                <a href="" class="dropdown-toggle no-after peers fxw-nw ai-c lh-1" data-toggle="dropdown">
                    <div class="peer mR-10">
                        <i class="ti-user"></i>
                    </div>
                    @auth
                        <div class="peer">
                            <span class="fsz-sm c-grey-900">{{ auth()->user()->name }}</span>
                        </div>
                    @endauth
                </a>
                <ul class="dropdown-menu fsz-sm">
                    <li>
                        <a href="/logout" class="d-b td-n pY-5 bgcH-grey-100 c-grey-700">
                            <i class="ti-power-off mR-10"></i>
                            <span>Logout</span>
                        </a>
                    </li>
                </ul>
            </li>
        </ul>

Please sign in or create an account to participate in this conversation.