Is the touch responsiveness of the toggle drop-down in the navbar lacking on mobile devices?

When I decrease the window width on my computer, the navbar's toggle button drops down to reveal the sections. However, when I visit the website on my mobile phone, the button doesn't drop down and acts more like an image. I suspect this is because the button isn't touch-responsive. How can I efficiently convert it into a touch-responsive button for mobile phones?

Below is the code I have worked on so far:

EDIT: In response to requests, here is additional code. This is the HTML head section:

<head>
  <title>****</title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" href="/assets/images/logo.png" type="image/x-icon">

    <!--fontawesome, bootstrap, jquery-->
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"> </script>
    <!--/fontawesome, bootstrap, jquery-->

    <script src="/assets/smooth-scroll.min.js"></script>
  <link href="/assets/stylesheet.css" rel="stylesheet">
</head>

HTML

<div class="container-fluid">
      <nav class="row navbar">
        <div class="navbar-header">
          <a class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"><i class="fa fa-lg fa-bars"></i>
          <a class="navbar-brand" href="/"><img src="/assets/images/logo.png" width="40" height="40" class="d-inline-block align-top" alt=""> ******</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
            <li><a data-scroll class="nav-item nav-link" href="#about">About</a></li>
            <li><a data-scroll class="nav-item nav-link" href="#getinvolved">Get Involved</a></li>
            <li><a data-scroll class="nav-item nav-link" href="#contact">Contact Us</a></li>
          </ul>
        </div>
      </nav>
    </div>

CSS

.navbar {
  padding: 10px 0px;
}

.navbar-toggle {
  border: 1px solid #000;
  padding: 11px 10px;
  border-radius: 2px;
}

.navbar-brand {
  font-size: 22px;
  padding: 10px 15px;
  color: #000;
}

.navbar-brand:hover, .navbar-brand:focus, .navbar-brand:active {
  color: #000;
}

.navbar-brand img{
  margin: 0px 10px 0px 0px
}

#navbar a, #navbar a:hover, #navbar a:focus, #navbar a:active {
  text-decoration: none;
  color: #000;
  cursor: default;

}

Answer №1

Did you forget to include jQuery? Your code seems to be working fine for me. Check out the JSFiddle here.

<div class="container-fluid">
  <nav class="row navbar">
    <div class="navbar-header">
      <a class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">uuuuu<i class="fa fa-lg fa-bars"></i>
      <a class="navbar-brand" href="#"><img src="" width="40" height="40" class="d-inline-block align-top" alt=""> ******</a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav navbar-right">
        <li><a data-scroll class="nav-item nav-link" href="#about">About</a></li>
        <li><a data-scroll class="nav-item nav-link" href="#getinvolved">Get Involved</a></li>
        <li><a data-scroll class="nav-item nav-link" href="#contact">Contact Us</a></li>
      </ul>
    </div>
  </nav>

It's also working on mobile for me. Feel free to share more code with us.

https://i.sstatic.net/mrhQR.png

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

PHP: Converting messy CSV data into beautifully formatted HTML tables

My client regularly sends CSV text files to my PHP application, where the elements in each row follow a consistent format but the commas that separate them vary. This inconsistency poses a challenge when trying to extract data and present it in an HTML tab ...

implementing page navigation with PHP

When attempting to display 10 product details on one page and then continue with more products on the next page, I encounter an issue. Clicking on the page 2 link at the bottom results in an error message stating "Please select the category." Can someone ...

How to extract text from an HTML element using Selenium

In the following HTML snippet, I need to extract the text of elements 1 and 2 individually. <div class="sc-492bf320-0 sc-7d450bff-9 crIwBV juiSXn"> <div data-change-key="homeScore.display" class="sc-18688171-0 sc-7d450bf ...

The MinWidth property in ColumnDefinition is not functioning as expected

Currently, I am encountering an unusual issue while using a Grid in WPF (XAML) and setting the MinWidth property in a ColumnDefinition. When I have 9 ColumnDefinitions with 'Width="*"' specified for each one, and then apply the MinWidth property ...

Why isn't this code from CodePen functioning on my local server?

I am experiencing an issue with a pen from CodePen that is not working on localhost, while everything else seems to be functioning correctly. I am puzzled as to why it is not working and how I can resolve this. CodePen Link After compiling SCSS to CSS and ...

Is there a way to turn off the "swipe to navigate back" feature in Microsoft Edge using JavaScript or jQuery?

Working on a website that features horizontal object rotation. For instance, starting with the front view of an object followed by side, back, other side, and then back to the front. In this case, there are 24 images of an object, each taken at a 15 degre ...

Guide on how to extract data from a database using a MySQL query and inputting values from a drop-down menu

In my project, I am faced with the task of selecting a city from a dropdown list and using jQuery to retrieve the people belonging to that city. Here is the code snippet I have implemented: <select class="form-control" id="personCity"> ...

Obtain the texture from a user upload and apply it to a geometry in three.js

As a beginner in three.js and JavaScript, I am excited about the possibilities and have been creating small Three.js scenes to improve my skills. My ultimate goal is to build a 3D website, but I am currently stuck on how to allow users to upload an image f ...

jQuery Hover Event Handling

I'm encountering an issue with syncing hover effects in two separate tables. Oddly, the first part of the function works fine on its own. However, when I add the second part, it breaks the first part without any errors. I refrained from including it ...

Embed full content in iframe using bootstrap 4

Embedding an iframe of an appointment scheduling frontend on my page has been a challenge. While the width is correct, the height of the frame is too small. Despite attempting various CSS modifications, I have not been able to achieve the desired result. I ...

What are some ways to enhance the content using CSS?

I have explored various solutions on stackoverflow, but none of them seem to work for me. I am struggling with expanding the content of the "Section" element when the page is empty. Check out my JsFiddle Project here HTML <body> & ...

What could be the reason for JavaScript delaying the execution of DOM statements until a variable is true?

Today I've been tackling numerous bugs, but there's one particularly tricky bug that has me stumped. The snippet of code below pertains to a basic logon page. Currently, the only valid username is 'admin' and the corresponding password ...

using jQuery to eliminate an HTML element based on its attribute

How can I remove an element with the attribute cursor = "pointer"? I want to achieve this using JavaScript in HTML. Specifically, I am looking to remove the following item: <g cursor="pointer"></g>. It's unclear to me why this element has ...

Unable to display scrollbar when generating dynamic content with jquery ajax

I have a jQuery report where I am generating dynamic HTML content (nested divs, span, label) using JSON. The report utilizes jQuery, mCustomScrollbar, commons, and jQueryUI. When I have a <div>...//some static code </div>, everything works per ...

Is there a way to adapt my existing navigation bar to collapse on smaller devices?

Struggling to make my navigation bar collapsible on my site designed for a class project. Wondering if this requires both HTML and CSS, or can it be achieved with just HTML since this is my first time working on responsive design. Below is the code I have ...

As you hover over various text, the central image will dynamically transform alongside each selection

Currently working on a website related to property planning for a customer. They have requested that when their customers hover over text, the central image should change. Is there a CSS-only method to achieve this? <div> <img src="http://www.ucl ...

Adjust the size of the image obtained from the JSON data

I am currently working on parsing JSON data which includes an image field that I want to adjust to a specific size. Despite my many attempts at tweaking the code, I seem to have lost track of why it is not functioning as desired. JSON var items=[]; ...

Insert a new row at the top of the AngularJS table

How can I add a row to the beginning in Angular? HTML: <title>Add Rows</title> <link href="http://cdn.foundation5.zurb.com/foundation.css" rel="stylesheet"> <script src="https://ajax.google ...

Is it just me or does my wrapper always hover above the bottom of the screen?

I have been working on coding a simple layout that I created last year. Most of the work is done, but I ran into an issue where the 'wrapper' div doesn't extend to the bottom of the page as expected. It almost looks like it has the "position ...

The `class="d-none d-lg-block"` is a handy feature in Bootstrap for hiding elements

I am having trouble implementing the class="d-none d-lg-block". It does not seem to be working as expected. Here is the code that I have been attempting to use: Could you please review it and let me know if there are any errors? <div class=& ...