The buttons in the Bootstrap modal are unresponsive

I'm attempting to create a modal navigation bar for mobile view but encountering an issue. When I click on the icon bar or menu bar in mobile view, none of the buttons inside the modal are responding. I'm quite stuck on this and would appreciate any help. Thank you in advance.

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="height: 100vh !important">
      <div class="modal-dialog" role="document">
         <div class="modal-content">
            <div class="modal-body" style="height: 100vh; opacity:1">
               <button type="button" class="close" data-dismiss="modal"  >&times;</button>
               <ul class="nav navbar-nav navbar-right hidden-lg hidden-md" >
                  <li><a href="#myPage">HOME1</a></li>
                  <li><a href="#band">BAND1</a></li>
                  <li><a href="#tour">TOUR1</a></li>
                  <li><a href="#contact">CONTACT</a></li>
                  <li class="dropdown">
                     <a class="dropdown-toggle" data-toggle="dropdown" href="#">MORE
                     <span class="caret"></span></a>
                     <ul class="dropdown-menu">
                        <li><a href="#">Merchandise</a></li>
                        <li><a href="#">Extras</a></li>
                        <li><a href="#">Media</a></li>
                     </ul>
                  </li>
                  <li><a href="#"><span class="glyphicon glyphicon-search"></span></a></li>
               </ul>
            </div>
         </div>
      </div>
   </div>
  <div class="bg-img-hero">
     <nav class="navbar  navbar-default navbar-fixed-top">
        <div class="container-fluid">
           <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myModal">
              <span class="icon-bar" style="color: yellow !important"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>    
              </button>

           </div>
           <div class="collapse navbar-collapse" id="myNavbar">
              <ul class="nav navbar-nav navbar-right" >
                 <li ><a href="HowItWorks.html" style="color: white !important">HOME</a></li>
                 <li><a href="#band" style="color: white !important">BAND</a></li>
                 <li><a href="#tour" style="color: white !important">TOUR</a></li>
                 <li><a href="#contact" style="color: white !important">CONTACT</a></li>
              </ul>
           </div>
           <div class="collapse navbar-collapse" id="myNavbar1">
              <ul class="nav navbar-nav navbar-right hidden-lg hidden-md" >
                 <li><a href="HowItWorks.html">HOME1</a></li>
                 <li><a href="#band">BAND1</a></li>
                 <li><a href="#tour">TOUR1</a></li>
                 <li><a href="#contact">CONTACT</a></li>
              </ul>
           </div>

        </div>
     </nav>
  </div>

Answer №1

Include All JavaScript & CSS files

Make the following change data-toggle="collapse" to data-toggle="modal"

<button type="button" class="navbar-toggle" data-toggle="modal" data-target="#myModal">
              <span class="icon-bar" style="color: yellow !important"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>    
              </button>

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" ></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="height: 100vh !important">
      <div class="modal-dialog" role="document">
         <div class="modal-content">
            <div class="modal-body" style="height: 100vh; opacity:1">
               <button type="button" class="close" data-dismiss="modal"  >&times;</button>
               <ul class="nav navbar-nav navbar-right hidden-lg hidden-md" >
                  <li><a href="#myPage">HOME1</a></li>
                  <li><a href="#band">BAND1</a></li>
                  <li><a href="#tour">TOUR1</a></li>
                  <li><a href="#contact">CONTACT</a></li>
                  <li class="dropdown">
                     <a class="dropdown-toggle" data-toggle="dropdown" href="#">MORE
                     <span class="caret"></span></a>
                     <ul class="dropdown-menu">
                        <li><a href="#">Merchandise</a></li>
                        <li><a href="#">Extras</a></li>
                        <li><a href="#">Media</a></li>
                     </ul>
                  </li>
                  <li><a href="#"><span class="glyphicon glyphicon-search"></span></a></li>
               </ul>
            </div>
         </div>
      </div>
   </div>
  <div class="bg-img-hero">
     <nav class="navbar  navbar-default navbar-fixed-top">
        <div class="container-fluid">
           <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="modal" data-target="#myModal">
              <span class="icon-bar" style="color: yellow !important"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>    
              </button>
              <img src="Images\logos\flexit-logo-TM-comp.png" style="padding-top:15px" >  
           </div>
           <div class="collapse navbar-collapse" id="myNavbar">
              <ul class="nav navbar-nav navbar-right" >
                 <li ><a href="HowItWorks.html" style="color: white !important">HOME</a></li>
                 <li><a href="#band" style="color: white !important">BAND</a></li>
                 <li><a href="#tour" style="color: white !important">TOUR</a></li>
                 <li><a href="#contact" style="color: white !important">CONTACT</a></li>
              </ul>
           </div>
           <div class="collapse navbar-collapse" id="myNavbar1">
              <ul class="nav navbar-nav navbar-right hidden-lg hidden-md" >
                 <li><a href="HowItWorks.html">HOME1</a></li>
                 <li><a href="#band">BAND1</a></li>
                 <li><a href="#tour">TOUR1</a></li>
                 <li><a href="#contact">CONTACT</a></li>
              </ul>
           </div>

        </div>
     </nav>
  </div>

Answer №2

Make sure to verify the versions of Bootstrap and jQuery you are using. Consider including CDNs like the following:

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

If these links are not included, collapsible elements may not function properly.

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

Changing the parent scope from the child component does not automatically reflect changes in an ng-repeat

I am facing an issue with the communication between a child controller and a parent controller. I have a function that adds data to a parent array which is used in an ng-repeat directive. Although the parent array gets updated correctly and its length is ...

Add to the current values of the REACT Form template property

I am new to working with REACT and I have been exploring whether it is possible to append a REACT Form control property value in order to enhance its functionality. To streamline the validation process, I have created a validation template that leverages ...

What is the best way to include a padding at the top of the second row?

I have two rows with three columns each. I am trying to create some spacing between the two rows. I attempted to achieve this by wrapping the rows and adding padding to the last child (which should be the second row). However, this approach did not work a ...

Designing a drop-down selection interface

http://jsfiddle.net/367ms/1/ I need assistance with my code. My goal is to have a blue border that appears 10 px below the text when hovered over. Additionally, I have a submenu that opens on hover, but it automatically closes when trying to navigate down ...

Creating a specific order for Arabic strings in HTML is simple and can be done by utilizing

I need to adjust the ordering of a datetime written in Arabic numbers. I must use an Arabic string and currently have the following C# code written in Arabic: std.InnerText = "17-02-2016"; The current output is in Arabic numerals, displayed as ٢٠١٦- ...

Steps to include a CSS file in Laravel 5.6 using npm

Here are the steps I've taken: Installed bootstrap-select using npm Edited resource/assets/bootstrap.js to add "require('bootstrap-select'); Executed npm run prod My Questions: Does the bootstrap-select library include sass or css files, ...

Dealing with unexpected modifications in a React class component

In short, I need to adjust the data in my class component before sending it to the server to match the API request format. To achieve this, I created a method called transformData within my class component which transforms the data extracted from the state ...

What could be causing the images' load event not to work as expected?

I'm attempting to implement a load event for my images using native JavaScript. Below is the code snippet I am currently using: var imgs = $("figure img"); // querySelectorAll for(var i = 0, l = imgs.length ; i < l ; ++i) imgs[i].addEventListen ...

Combining PHP JQuery Dialog with Datatables results in a sleek design loss

Recently, I encountered an issue with my code. I have a file called incident_view.php which pulls data from the database and displays it using Datatables. Everything was working fine until I tried to open this page in a JQuery dialog on another page called ...

What is the best way to invoke a controller method using jQuery within a cshtml file?

I am working on a project where I need to add user information to the database by calling a function in my controller class. The user's information is entered through a form created in a .cshtml file that interacts with an external JavaScript file. Is ...

Is AJAX causing issues with my media uploader and color picker?

Currently, I have incorporated tabbed navigation within a WordPress admin page and it is functioning properly on its own (data can be saved). However, I am now looking to implement some AJAX functionality for toggling between pages. The issue arises when t ...

Issue encountered in AngularJS while configuring resources for the action `query`: Anticipated response was an object, but received an array instead

I've been attempting to utilize Angular 1.3 to access a REST service, but I keep encountering an error stating "Error: error:badcfg Response does not match configured parameter". My suspicion lies in the controller where I invoke $scope.data. Even th ...

Buttons are excellent for desktop displays but may not be as visually appealing on mobile devices, especially when using Bootstrap 4

As someone new to coding, I have been given the task of revamping my school's website. I have used buttons for navigation on certain pages, but I have noticed that they do not look good on mobile devices. How can I improve their appearance, perhaps b ...

Separate your HTML code and move it to a different HTML document within Angular CLI

Is there a way to extract my HTML section from the file app.compontent.ts and place it in a separate HTML document? I've tried adding the HTML code directly into the generated class app.component.ts but it doesn't seem to work. I'd also lik ...

Uncovered event listener in Angular tests

Imagine having a custom directive: angular.module('foo').directive('myDir', function () { return { restrict: 'E', link: function (scope) { var watcher = scope.$watch('foo, function () {}); scope.$on ...

Assigning background colors based on the data stored in a specific field of a MySQL database

I have successfully implemented a Ticketing System using PHP and MySQL database. The view tickets page displays each ticket from the database along with its priority level, which can be Low, Normal or High. Currently, the priority value pulled from the d ...

Issues with Wordpress plugins functioning properly in Internet Explorer versions 9 and above

My wordpress site is running smoothly on Chrome, Safari, and Firefox, but Internet Explorer seems to be causing some issues. I had a similar problem with two plugins across all browsers, but after disabling 'AJAX' transitions for certain pages, e ...

Modify the parent window's URL with the help of fancybox

In my recent project, I am facing an issue. I have a gallery page called gallery.php using PHP which includes jQuery fancybox to display each photo in the gallery as a pop-up. Additionally, I have a separate page details.php to show individual photo detail ...

I used npm to install a package, but for some reason, it's not appearing in

When attempting to install jquery using npm, I entered the following command: npm install jquery However, upon opening the destination folder, it was empty. (The below text was copied from cmd) > C:\Users\mandar\Desktop\Mady> ...

Issue: App is not being styled with Material UI Theme Colors

I'm having trouble changing the primary and secondary colors of Material UI. Even after setting the colors in the theme, the controls like Buttons or Fabs still use the default colors. Can someone help me figure out what I'm missing? index.js /* ...