Mobile version experiencing issue with Navbar not collapsing

The dropdown navigation bar on the mobile version of my website is not functioning properly. Despite several attempts, I have been unable to figure out a way to make it work effectively.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>COS Gym</title>
<link href="cos-gym.css" rel="stylesheet" type= "text/css" />
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="07656868737473756677473229362934">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"gt;
</headgt;
<bodygt;
<header >
<div class="container">
  <nav font-size="120%" margin-left="30%" margin-top="8%" class="navbar navbar-expand-lg navbar-light">
    <a href="#" text-decoration="none" padding="4%" class="navbar-brand">
      <div class="logo">
        <img src="images/logo_gym.png">
      </div>
    </a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#toggleMobileMenu" aria-controls="toggleMobileMenu" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></spangt;
    </button>
    <div class="collapse navbar-collapse" id="#toggleMobileMenu">
      <ul class="navbar-nav ms-auto mb-2 mb-lg-0 text-center justify-content-end">
        <li class="nav-item"><a class="nav-link active" aria-current="page" href="index.html">Home</agt;</ligt;
        <li class="nav-item"><a class="nav-link active" aria-current="page" href="about.html">About</agt;</ligt;
        <li class="nav-item"><a class="nav-link active" aria-current="page" href="schedule.html">Schedule</agt;</ligt;
        <li class="nav-item"><a class="nav-link active" aria-current="page" href="online.html">Online</agt;</ligt;
        <li class="nav-item"><a class="nav-link active" aria-current="page" href="shop.html">Shop</agt;</ligt;
        <li class="nav-item"><a class="nav-link active" aria-current="page" href="contact.html">Contact</agt;</ligt;
      </ulg>
    </divgt;
 </navgt;
</divgt; 
</headergt;
<maingt;
<div class="imghome">
  <img src="images/home.jpg">
  <div class="title-home"><ht>COS GYM</ht>
  <a href="login.html"><button class="btn-1">Log in</buttongt;</agt;
  <a href="registration.html"><button class="btn-2">Sign up</buttongt;</agt;
<div class="three-images">
<figure>
  <img src="images/main1.jpg">
<figcaption class="f1">Zumba Dance</figcaption>
</figuergt;
<figuregt;
<img src="images/main2.jpg">
<figcaption class="f2">Power Training</figcaption>
</figuergt;
<figuregt;
<img src="images/main3.jpg">
<figcaption class="f3">Yoga Fitness</figcaption>
</figuergt;
</divgt;
</maingt;
<footergt;
  <divgt;
    <ulg>
     <dthgt;Email Us</dthgt;
     <dthgt;<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="80ede1e9ecc0e3eff3e7f9edaee3efed">[email protected]</agt></dthgt;
    </ulgt;
  </divgt;
   <divgt;
     <h3gt;Welcome to ChrisOlySim Gym</hggt;
     <h4gt;Contact Us 989-888-9999</hggt;
   </divgt;
   <divgt;
    <ulg>
     <dthgt;Follow Us</dthgt;
     <dthgt>lt;i class="fab fa-facebook-f"></igt;
      <i class="fab fa-instagram"></igt;
      <>i class="fab fa-twitter"></igt;
    </dthgt;
    </ulggt;
    </divgt;
    </footergt;
    <script src="https://kit.fontawesome.com/42ca52e1de.js" crossorigin="anonymous"></scriptgt;
    <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="50323f3f24232422312010657e617e67">[email protected]</agt>/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1py" crossorigin="anonymous"></script>
  </bodygt;
</htmlgt;

I am facing issues with the 'ms-auto' class and difficulty adjusting the text size beyond a certain point on the webpage. Can someone provide assistance please? I have tried rearranging script orders, incorporating JQuery, but nothing seems to solve the problem. The only temporary fix I found was using the 'container-fluid' class, which disrupts the functionality on mobile devices. How can I resolve this issue?

Answer №1

The reason for the issue is due to still using classes from BS4. For a solution, please refer to the documentation of BS5 here.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"></title>
    <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cba9a4a4bfb8bfb9aabb8bfee5fbe5f9">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"></head>
<body>
    <nav class="navbar navbar-expand-lg navbar-light bg-light>
        <div class="container-fluid>
            <a class="navbar-brand" href="#">Navbar</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
                <div class="navbar-nav">
                    <a class="nav-link active" aria-current="page" href="#">Home</a>
                    <a class="nav-link" href="#">Features</a>
                    <a class="nav-link" href="#">Pricing</a>
                    <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
                </div>
            </div>
        </div>
    </nav>

    <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="21434e4e55525553405161140f110f13">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</body>
</html>

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

Can we safely save a value in session storage directly from the main.js file in Vue?

Throughout the user session managed by Vuex, I have a session storage value set to false that needs to be monitored. Setting up this value directly from the main.js file looks like this: import { createApp } from 'vue'; import App from './Ap ...

Sorting through a list post a retrieval action

Could you guys please help me understand why my code is not functioning properly? I am receiving an array from my backend rails API, which is providing the data correctly. I have created an empty array where I filter the records based on their ID. The fi ...

How can dependencies be conditionally imported in a module that is shared between React (Next.js) and React Native?

I am looking to create a shared Typescript module that can be used in both a React (Next.js) web app and React Native mobile apps. This module will be responsible for managing communication with the backend (Firebase) and handling state management using t ...

The banner may be cropped when viewing on lower resolutions such as mobile devices or when zoomed in

I've encountered a similar issue on a popular website, www.godaddy.com. When zooming in or accessing the site from a mobile device, the right side of the banner gets cut off. However, when viewed on a full-sized computer screen, there are no issues. M ...

How can I emphasize only a portion of a word in ReactJS and Material UI?

I am attempting to replicate this design: https://i.stack.imgur.com/H8gKF.png So far, this is what I have been able to achieve: https://i.stack.imgur.com/TJXXb.png My project utilizes Material UI and ReactJS. Below is a snippet of the code: bodyTitle: { ...

Submitting forms with Ajax

Hi everyone, I'm encountering an issue with the post data not appearing as expected and it seems like the functionality is not working properly. The main requirement was for it to trigger an accept/deny action with an attached id number and a value fo ...

CakePHP and Legacy Ajax Script Integration

I have an old script that I want to integrate into a cakephp application. The script uses $_POST and I'm not very experienced with this, so I need some assistance with the integration. This is what the script consists of: THE JAVASCRIPT: prototype ...

ran into the error that this state is not a function

Every time I run my code, I encounter the error message this.setState is not a function. Can anyone offer guidance on how to fix this issue? Thank you! spiele.listUsers(params, function(err, data) { if (err) console.log(err, err.stack); else con ...

I'm having trouble with the routing of a Node.js REST API built with Express and Mongoose

I am currently in the process of constructing a RESTful webservice by following a tutorial that can be found at: However, I have encountered an issue where it is returning a CANNOT GET/ reports error. Despite my efforts to troubleshoot and rectify the pro ...

I am having trouble accessing the input field in my AngularJS controller

Having an issue with my Ionic framework setup using AngularJS. I am unable to access the input field "groupName" in my controller, as it always returns "undefined". I was under the impression that using ng-model would automatically add it to the controlle ...

Updating a function in jQuery UI after dynamically loading content through AJAX

I've been on a quest for days now, searching high and low for an answer to my dilemma. While I've managed to solve most of the issues that arose after adding AJAX calls to my code, there's one piece that still eludes me. Just to provide som ...

Ways to dynamically emphasize text within ngFor loop

Within my ngFor loop, I have a set of rows. <div *ngFor="let block of data;"> <div class="class-row"> <div class="left">A Label:</div> <div class="right">{{block.key1}}</div> </div> <div class="clas ...

Change the background color of a table cell based on its value with the help of JavaScript

I am attempting to apply color to cells in an HTML table (generated automatically by Python and Django) based on the content of the cells. Below is my table. I want to specifically color the column "status". Whenever the word "Cloture" appears, I would li ...

"Discover the step-by-step process for customizing the icon colors within Bootstrap components

I successfully incorporated a dark mode into my Vue project built with Bootstrap 5.2. However, I am facing an issue while trying to change the color (to be white) of the two icons below: The first one is from a form-select https://i.sstatic.net/5ayvH.png ...

What is the best method for sending files (with or without additional form data) using Ajax and PHP?

I've been trying to implement a simple fix by using Ajax for file uploads in my project. Despite successfully submitting other forms through Ajax, I'm facing issues with the file upload functionality. The problem arises when Apache runs the PHP s ...

Tips for implementing collapsible mobile navigation in Django with the help of Materialize CSS

I'm facing some issues with implementing a responsive navbar that collapses into a 'hamburger bar' on mobile devices and in split view. I have managed to display the hamburger bar, but when I click on it nothing happens. Here's my curre ...

Creating a visually dynamic stack of images using javascript, jquery, and HTML

I'm interested in creating a unique image viewer using javascript/jQuery/HTML that combines elements of a book page flip and iTunes coverflow, optimized for mobile device browsers. I've been searching for tutorials to help kickstart this project, ...

In the realm of Laravel, Vue, and Javascript, one may question: what is the best approach to omitting a key

When working with JSON data, I encountered a problem where leaving some keys unfilled resulted in incorrect results. I want to find a way to skip these keys if they are not filled. I have shared my code for both the backend and frontend below. Backend La ...

The function has exceeded the time limit of 60000 milliseconds. Please make sure that the callback is completed

Exploring the capabilities of Cucumber with Protractor has been an intriguing journey for me. As I delved into creating a feature in Gherkin language, outlining the steps and scenarios necessary for my end-to-end tests, a new world of possibilities opened ...

Designing a File Export Functionality in MVC3

I am working on a strongly typed View in ASP.NET MVC3 that displays a Model, and I want to implement a feature where the user can download the displayed model as a CSV file. My initial thought is to create a link that points to another action on the contro ...