Navbar in Bootstrap 4 Disappearing Upon Icon Selection

Whenever my page is small enough to display the collapsible navbar, you can simply click or tap the icon to open the navbar. However, if you try to click or tap it again, the navbar won't close and I'm uncertain as to why.

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<header>
        <nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top mb-2">
            <a href="/mwlas/" class="navbar-brand">
                <img src="/mwlas/_img/logo.png" alt="logo"/>
                <span class="d-none d-sm-block float-right ml-3">Made with Love And Sarcasm</span></a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
                    aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle Navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item">
                        <a href="/mwlas/" class="nav-link">Home</a>
                    </li>
                    <li class="nav-item">
                        <a href="/mwlas/portfolio" class="nav-link">Portfolio</a>
                    </li>
                    <li class="nav-item">
                        <a href="/mwlas/shop" class="nav-link">Shop</a>
                    </li>
                    <li class="nav-item">
                        <a href="/mwlas/blog" class="nav-link">Blog</a>
                    </li>
                </ul>
                <form class="form-inline">
                    <button class="btn btn-outline-success my-2 my-sm-0" type="button"
                            onclick="location.href='/mwlas/login.php'">Login
                    </button>
                </form>
            </div>
        </nav>
    </header>

Answer №1

Upon reviewing the source code of your page, it appears that you have duplicated the script imports for jQuery, popper, and bootstrap.js.

This duplication has caused some issues and conflicts within your website. It is important to follow the instructions outlined in the Getting Started guide.

To resolve this issue, ensure that you are importing the scripts only once as recommended in the documentation.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Previewing multiple images in multiple divs before uploading using jQuery

Currently, I am working on a Bootstrap Modal that allows users to upload multiple images. The functionality is such that when the user clicks the 'Add-Product-Image' button, it generates a new image upload input form. Once the user selects an ima ...

Is it possible to automatically navigate to a different webpage upon clicking anywhere on the background?

I have created a website with a gif background and I want to redirect to another site (like softlaunch) after clicking anywhere on the screen. This is my HTML and CSS: body { background: url(main.gif) no-repeat center center fixed; -webkit-backgrou ...

Fade in animation when scrolling

I have developed a simple link animation for scrolling. This link can be used to navigate to a section within the same page or an external URL. However, there are a couple of issues that I encountered with this implementation. First Issue: When clickin ...

Personalizing Bootstrap Styles Using Sass

As a newcomer to Bootstrap 5 and Sass, I have been thoroughly enjoying the learning process. However, I have a couple of questions that have come up along the way... When it comes to customizing Bootstrap Sass, I understand the concept of variable overrid ...

The curious conduct of wild safari creatures

I have been using JavaScript to split my ePub chapter into pages by wrapping the code with new divs that represent separate pages. I have also created CSS styles for these new divs. Everything works perfectly when the file has a filename extension of &apos ...

What is the reason for the absence of styles in index.html when accessing the local server?

When using node.js to open the server, I encountered an issue where the styles are not displaying. Strangely, when opening index.html directly in the browser, all the styles show up correctly. What could be causing this discrepancy? index.html <!doctyp ...

Block public access to the root directory of my domain to enhance security

I have a website at www.domain.com. While inspecting the element and trying to access www.domain.com/css/, I noticed that it displayed all the files in the directory. The structure is as follows: /css/ /images/ /include/ /js/ index.html contact.html si ...

Struggling with deploying Django and getting static files to load on Google App Engine?

Hey there, I'm currently facing an issue with deploying my Django app on Google App Engine. While the app works perfectly fine locally, it's not functioning correctly on GAE. After some investigation, I discovered that the problem lies with my st ...

"Utilize CSS GRID without the need for ::before and ::after in grid layouts

While working with CSS Grid, I noticed that the grid also includes the before and after elements as grid items. Is there a way to address this issue? .wrapper { display: grid; grid-template-columns: 100px 100px 100px; grid-gap: 10px; background- ...

Contrasting text-transform: uppercase; and the use of all capital letters

Could you explain the distinction between <span style="text-transform: uppercase;">some text</span> and <span>SOME TEXT</span> They appear identical visually, but I've come across a suggestion that it's preferable to k ...

Images located in the "/images" folder are not being properly served as the URL is being interpreted as relative to the "/css" directory

All of the CSS files are located in the src/main/resources/public/css directory, while the images are stored in src/main/resources/public/images. When attempting to access images from style sheets, like this example: background-image: url("/images/d ...

What is the method for obtaining receipt numbers in sequential order, such as the format AB0810001?

Is AB the receipt code that should remain constant followed by the current date (08) and 10001 as the receipt number? ...

The navigation menu in Javascript is flickering

I'm experiencing an issue with my navigation menu that has sublinks. Whenever I hover over a link with sublinks, it starts blinking as I move my mouse across the links. Here is an illustration of the problem: function myFunction(i) { document ...

Issues arising from the alignment of css in html documents

Can anyone assist with my issue? I am trying to add a header to my webpage, but I'm facing a problem where the order of div declarations determines their placement on the page. The first declared div appears on top, and the second one appears below, r ...

CSS transitions in React fail to function when the state changes to true

A challenge arises with the error bar, which should ease-in when error = true. Within the render() method: render() { const { errors } = this.props; return ( <div id='messages'> <div className={ errors ? &ap ...

Is there a way to include text in a video similar to the style used by PayPal?

PayPal uses the tagline "You Make it, We'll Pay It" displayed on top of a video with a subtle play button located in the corner. By clicking this play button, the video initiates playback and smoothly transitions from a dark overlay to the video itsel ...

html - Removing excess space following the footer

Having trouble getting rid of the excess white space below my footer on this website: I attempted to search for a solution online and even added padding:0; to the footer's CSS, but unfortunately it didn't solve the issue. Appreciate any assista ...

Aligning text to the center of the second column on a page using Bootstrap

A header is designed with two columns: the first column contains the logo, while the second column holds a centered heading. Below that, the main content also features a centered heading. The challenge is to align the header heading to the center of the ma ...

Ways to display only a specific color in an image

Looking to work with an image that contains predefined color blocks? Take this example picture as reference: https://i.sstatic.net/QlwvY.png Is there a method to display only certain colored areas while keeping the rest transparent? Note that no edge pat ...

HTML border width is set to 100%, but there seems to be an issue with the responsive menu border and icon display

One issue I'm encountering with my website involves the border at the bottom of my navigation bar. Despite trying to adjust the box-sizing property to border-box, I still can't get it to display correctly. My goal is to have the border span 100% ...