The navigation bar seems to be malfunctioning on specific pages, which is quite unusual

My bootstrap 4 collapsible navbar is working perfectly on the index page and another specific page. However, when I navigate to a different page that is not one of those two, the collapsible navbar stops functioning. Even though I have copied and pasted all the code from the index page.

I have experimented with different versions of bootstrap 4 and even tried using default navbars provided by bootstrap, but none of them seem to work.

Below is the HTML code for the navbar:

<nav class="navbar bg-custom navbar-expand-lg navbar-dark">
    <a class="navbar-brand" href="index"><img src="dist/img/logo_yme.png" alt="Logo" width="236"></a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <i class="fas fa-bars"></i>
    </button>
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="nav navbar-nav ml-auto">
            <li class="nav-item animated"><a class="nav-link" href="vacatures">Vacatures</a></li>
            <li class="nav-item animated"><a class="nav-link" href="fotos">foto's</a></li>
            <li class="nav-item animated"><a class="nav-link" href="contact">Contact</a></li>
        </ul>
    </div>
</nav>

In the head tag, these are the links being used:

<link rel="stylesheet" href="./dist/css/main.css"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
          integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"/>
<link href="https://fonts.googleapis.com/css?family=Didact+Gothic&display=swap" rel="stylesheet">

Although everything seems to be loading correctly in the Network tab, the collapsed menu does not function as expected on certain pages without any error messages appearing in the console.

NOTE: I have added custom routing in my .htaccess file which eliminates the need for file extensions.

Code in .htaccess:

# mod_rewrite starts here

RewriteEngine on

# does not apply to existing directories, meaning that if the folder exists on the server then don't change anything and don't run the rule!!!!!

RewriteCond %{REQUEST_FILENAME} !-d

# Check for files with .html extension

RewriteCond %{REQUEST_FILENAME}\.html -f

# Here we show the page that has the .html extension

RewriteRule ^(.*)$ $1.html [NC,L]

Answer №1

Beginner blunder: Oops, I totally spaced on including the js files -,-

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

What is the best way to position multi-line text alongside an image without it wrapping below the image?

I managed to align a single line of text with an image successfully (view fiddle). <div class="profile-details-wrapper"> <img class="profile-picture" src="http://placehold.it/50x50" /> <span class="profile-details"> username &l ...

Ensure that the text within the ng-repeat is wrapped in a span element and each

When using ng repeat in span, I encountered a word breaking into a new line. Here is the actual output: https://i.stack.imgur.com/k4c9k.png To style this, I implemented the following CSS: border: 1px solid #ECE9E6; border-radius: 3px; text- ...

Struggling with a scrolling problem in Bootstrap 4 horizontal cards?

Recently, I utilized a bootstrap card to display an image with text below it. I opted for the card class because of its solid structure and to avoid excessive CSS styling to horizontally align div lists. I envisioned creating an image gallery with a horizo ...

a div sandwiched between two others

I am trying to nest a <div> within another <div> and center it within the parent. Here is my current approach: <div id="redthing"> <div id="whitebox" > </div> </div> The CSS code I am using is as follows: #red ...

Having trouble positioning the label directly below another label

As a beginner in CSS, I am struggling to align "Low" under "Work". I have not been successful so far. Can someone please provide me with suggestions? Please refer to the screenshot in this link: enter image description here ...

Prevent ui-select from being highlighted when clicked

here's a dilemma : (all in angular 1) I'm using a ui-select like this : https://i.stack.imgur.com/RzH2u.png Here's the code snippet : <div class="formZone-group"> <div class="mandatory-fl"> <div class="man ...

Utilizing CSS for displaying and hiding content based on its unique identifier

Is it possible to show/hide a div using only CSS based on its ID? Showcasing this functionality in jQuery or vanilla JavaScript is straightforward, but can the same effect be achieved with pure CSS? The checkbox hack requires a specific structure to func ...

Transforming HTML 'img' elements into React components without losing styling: How do I achieve this with html-to-react?

I am seeking guidance regarding the usage of the html-to-react library. Consider the following html string: '<div> <img src="test.png" style="width: 100px;"/> <img src="test2.png" style="margin: 0px 4px;"/> </div>' ...

How to horizontally align Material-UI elements in ReactJS

My goal is to create a user-friendly form where respondents can input answers to questions and select one as the preferred option by using a radio button. However, I'm facing an issue where Material-UI displays each element on its own line. This is t ...

Scaling images proportionally using CSS (without the need for JavaScript, ideally!)

Is there a way to proportionally scale images using CSS? I'm looking for a solution where the image adjusts to the full container size, becoming larger or smaller based on the container dimensions. Additionally, I want the image to be displayed in th ...

Unable to view Django templates in default Django project

Recently, I created a fresh Django project and set up a new superuser. Everything seemed to be working fine until I tried accessing the admin interface. To my surprise, none of the default CSS files were being applied. After some investigation, I realize ...

Is there a way to switch the sorting order on a Bootstrap page using a button without having to refresh the page?

I'm currently working on a template for an app that already exists and would like to add a button to change the sort order of displayed elements on a webpage. The page is styled using Bootstrap 5.3, so I have access to jQuery and other Bootstrap featu ...

"Controlling Selected Options in Bootstrap Dual Listbox: A Guide to Limiting Choices

I am utilizing the Bootstrap Dual Listbox plugin to assist users in selecting specific options. I have successfully integrated this plugin into my project. However, I encountered an issue when attempting to impose a limit on the number of options a user ...

Align Horizontal Fixed Element

<html> <head> <style> #rectangle { position: absolute; right: 0; bottom: 0; width: 150px; height: 200px; } </st ...

css - aligning text below another text in the center

Looking to style a text in a specific color with a message about another text below it? Want the text centered but not sure how to position it correctly? margin: 0px auto; If this code isn't delivering the desired result and is positioning your text ...

Bootstrap has been successfully installed and is functioning properly; however, the custom styling does not seem to be

After successfully installing bootstrap and JavaScript through NPM in my Laravel 6 project, I have noticed that the bootstrap is functioning properly on my website. However, I encountered an issue when trying to add custom styles in the resources/sass/ap ...

Separate compound words without hyphens at the boundaries of each word

I am currently incorporating the use of Bootstrap for my project. Let's assume that I have text displayed in this way: "Stackoverflow" Is there a method to automatically ensure that it breaks like below if the text exceeds the container: "Stack ...

How can I create a thumbnail rectangle and wrap item text with Ionic framework?

Just diving into Ionic and I have a quick query that's not covered in the documentation. Is there a straightforward way to utilize Ionic classes to left-align content currently positioned below an image? The code snippet I'm working with looks ...

Issue when trying to populate an ASP.NET textbox control using the HTML5 "date" type

On my asp.net page, I have included an HTML5 TextBox control set to type "date." The code snippet for the control is as follows: <asp:TextBox ID="TextBoxMyDate" runat="server" type="date"/> Interacting with the control on the page works smoothly, a ...

Turning JavaScript Object into a Decimal Value

I've been working on an application where I want to be able to add up the columns of an HTML table. I managed to add inputs to the table successfully, but when trying to sum up the columns, I keep getting a "NaN" error. /* Function for calculating ...