The navigation bar collapses, but the collapsed menu edition is not being displayed

I am experiencing an issue with the navbar menu on my bootstrap website. While it displays correctly on desktop, the menu appears differently on tablets and mobile devices when it collapses. The dropdown menu that shows up on mobile looks similar to the desktop version instead of the expected format for mobile screens:

HTML:

  <nav class="navbar navbar-simelsa">
  <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
       <div class="menu-text hidden-lg hidden-md hidden-sm">Menú<button type="button" class="navbar-toggle collapsed navbar-bottom" data-toggle="collapse" data-target="#navbar-simelsa">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      </div>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse navbar-center" id="navbar-simelsa">
      <ul class="nav navbar-nav">
        <li class="inicio"><a href="#">Inicio</a></li>
        <li class="nosotros"><a href="#">Nosotros</a></li>
        <li class="dropdown servicios">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Servicios <span class="caret"></span></a>
          <ul class="dropdown-menu" role="menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
            <li class="divider"></li>
            <li><a href="#">One more separated link</a></li>
          </ul>
        </li>
       <li class="productos"><a href="#">Productos</a></li>
        <li class="noticias"><a href="#">Noticias</a></li>
        <li class="contacto"><a href="#">Contacto</a></li>
      </ul>
        <li class="lang navbar-right nav navbar-nav"><a href="#">ESP | ENG</a></li>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

CSS:

@media (min-width: 1024px) {

.slick-prev, .slick-next {
    top: -12% !important;
    }
}
@media (max-width: 1024px) {

.header-bg {
    background: none !important;
}

...

/*
   Remaining CSS code goes here
*/

...

.social ul li:hover
{
        -webkit-animation: swing 1s ease;
        animation: swing 1s ease;
        -webkit-animation-iteration-count: 1;
        animation-iteration-count: 1;
}

Answer №1

To make the necessary adjustments, ensure that you modify the <nav> class from navbar navbar-simelsa to:

navbar navbar-default navbar-simelsa

Don't forget to include bootstrap's CSS, jQuery, and bootstrap's Javascript in the <head>:

<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

<script src="https://code.jquery.com/jquery-1.11.2.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

Refer to the documentation for navbar and collapse.js.

HTML:

<nav class="navbar navbar-default navbar-simelsa">
  <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-simelsa">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Brand</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse navbar-center" id="navbar-simelsa">
      <ul class="nav navbar-nav">
        <li class="inicio"><a href="#">Inicio</a>
        </li>
        <li class="nosotros"><a href="#">Nosotros</a>
        </li>
        <li class="dropdown servicios">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Servicios <span class="caret"></span></a>
          <ul class="dropdown-menu" role="menu">
            <li><a href="#">Action</a>
            </li>
            <li><a href="#">Another action</a>
            </li>
            <li><a href="#">Something else here</a>
            </li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a>
            </li>
            <li class="divider"></li>
            <li><a href="#">One more separated link</a>
            </li>
          </ul>
        </li>
        <li class="productos"><a href="#">Productos</a>
        </li>
        <li class="noticias"><a href="#">Noticias</a>
        </li>
        <li class="contacto"><a href="#">Contacto</a>
        </li>
      </ul>
      <li class="lang navbar-right nav navbar-nav"><a href="#">ESP | ENG</a>
      </li>
    </div>
    <!-- /.navbar-collapse -->
  </div>
  <!-- /.container-fluid -->
</nav>

To see a demonstration, view this Example.

Answer №2

In my opinion, it is important to maintain the class navbar-default within the <nav> element:

<nav class="navbar navabar-default navbar-simelsa">

Afterwards, you have the option to customize the style using your own class navbar-simelsa

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

Creating a clickable color-changing grid: A step-by-step guide

In a grid of size 12 by 12, each corner will be clickable, selecting a 6x3 cell area starting from the corner. The selected cells will change color upon clicking any of the 4 corners. After selecting one corner, the remaining cells (126 cells) will be che ...

Make sure that the function displays the output once it has been received using the jQuery.get method

This script fetches data using the $.get method from an XML file on an ASP ashx server: $.get("http://www.example.com/example.ashx", { From: txtFrom, To: txtTo, Date: txtTime }, function (data) { var arr ...

Struggling to make Datatables function properly with basic JSON data

As a newcomer to frontend development, I'm attempting to convert a JSON call into a table format. After researching, it seems like datatables is the best tool for this task. However, I'm struggling to make it work. Here is my JSON GET call: GET ...

The Cake App using jQuery Ajax is unable to function properly on a remote server

I'm encountering an issue with my Cake App. Here is my action code: public function event($year, $month) { if($this->RequestHandler->isAjax()) return new CakeResponse(array('body'=> json_encode($this->Event- ...

Is it possible to use the Web Interface of the Watson Retrieve and Rank service to upload a zip file containing htmls or another zip file containing json files?

Is it possible to utilize the Web Interface of Watson Retrieve and Rank service to upload a zip file containing HTMLs or a zip file with JSON files? ...

Firefox not rendering responsive YouTube embed properly

This method of embedding seems to be functioning well on all browsers except for Firefox; I took advantage of a free trial at crossbrowsertesting.com to verify. I’m not using a direct iFrame embed, and all the solutions I’ve come across are related to ...

Utilizing an HTML time picker for scheduling specific time intervals

Is it possible to use an HTML time picker with a specific interval? https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time According to the link, the step attribute is supported, but I have tested it on the latest versions of Chrome, Edge, ...

Revealing a typescript function for interacting with HTML pages through manual calls

Currently, I am in the process of developing a TypeScript modular library that will be bundled using Parcel JS. The main purpose of this library is to provide specific functionality to applications. In order for the consuming application or web page to uti ...

Using jQuery to insert the AJAX upload response into a textarea

Currently, I am in the process of designing a form that includes a textarea where users can upload AJAX images using a unique [image UUID] tag. This allows users to upload multiple images and adjust them to their desired position. This is how it currently ...

Construct a div element using JSON information

I am retrieving information from a database and organizing it into a JSON array. Here is the data that I have: [{"id":"0","name":"red","percentage":"60"},{"id":"1","name":"blue","percentage":"58"},{"id":"4","name":"green","percentage":"12"}] The structu ...

Reorganizing JSON data using JavaScript

I've been diving into learning JavaScript and I've hit a roadblock at work with structuring JSON data. Despite spending a considerable amount of time on it, I just can't seem to crack the correct format for this JSON challenge. Here's w ...

If you want to retrieve the calculated value of a div using jQuery

I have a scenario where I have 3 list items (li) under an unordered list (ul). I am interested in finding the height of these list items, but without explicitly defining their height. So far, when inspecting with Firebug, I noticed that the computed height ...

Scaling down in CSS does not center the element properly using the margin 0 auto technique when the scaled element was larger than the container before scaling

Upon scaling down an element that previously overflowed its container, I noticed that margin: 0 auto no longer centers the element as expected. Interestingly, even using transform-origin: center center did not fix this issue. It seems that the auto margins ...

Tips for showing pictures in a React Native Android application

Looking to make images span the full width of the device screen? I've tried various CSS codes, but none seem to fill the entire width. Here is the code snippet: <View style={styles.container}> <View> <Image source={require ...

Is it achievable to utilize HTML tabindex for activating a function?

Currently working on an application using PhoneGap, where I encounter a complex form layout. The form consists of a text input field at the top, followed by multiple buttons and additional text inputs below. I am wondering if it is feasible to activate a ...

Using mathematical operations in Sass mixins with variable arguments

When working with CSS sizing, I prefer using rem units with pixel fallbacks and am currently creating mixins to streamline the process. For setting font sizes, it's a simple task: @mixin font-size($size) { font-size: $size + px; font-size: ($size ...

Decoding HTML using jQuery AJAX

I need to populate a div with an HTML table using Ajax. HTML: <div id="tableDiv"></div> Javascript: $.ajax({ url: '../include/generateTable.php', success: function(data) { $("#tableDiv").html(data); }, data: {id: id, numPerPage: ...

Empty Textarea Issue on iOS Safari on Mobile Device

I've encountered an issue with a textarea element in a form. After clicking on a button to show the form (which includes dynamic HTML), I can see the textarea element with all its styles applied. However, when I try to type in the textarea on iOS Saf ...

Having trouble getting jQuery(this) to work with qtip?

I am currently working with jQuery's qtip plugin to display a hidden value upon hovering over icons that are already rendered. However, I am running into an issue where only the first item in the list is being displayed in the qtip. I have tried using ...

Failure of knockout CSS binding to apply a class

I am attempting to assign a class dynamically based on a boolean value. Here is the structure of my code: <input data-bind=" css: { 'chkBxEdit': gThirdCheckboxEnabled(), 'chkBx': !gThirdCheckboxEnabled() ...