Twitter-bootstrap: navigation bar does not appear on mobile devices

Currently engrossed in an angular2 project utilizing angular-cli... I'm facing some challenges while trying to craft a responsive navbar with bootstrap 3. The issue arises when testing the navbar on Chrome dev tools with the iPhone 5 screen size, where only the collapse button and brand text are visible. Any insights on what could be causing this glitch? Could it possibly be due to jQuery not being loaded? If so, how can I verify if it's loaded (using ng-cli)?

Here's my navbar code:

<nav class="navbar navbar-toggleable-md navbar-light">

        <div class="navbar-header">
            <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-expanded="false" aria-label="toggle navigation"><span class="icon-bar"></span></button>                       
        </div>
        <a class="navbar-brand" href="#">Retail Mobile</a>

        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="nav navbar-nav">
                <li [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" class="nav-item"><a [routerLink]="['/home']"><span class="glyphicon glyphicon-home"></span> Home</a></li>
                <li [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" class="nav-item"><a [routerLink]="['/checkBarcodes']"><span class="glyphicon glyphicon-barcode"></span> Check Barcodes</a></li>
                <li [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" class="nav-item"><a [routerLink]="['/stockTake']"><span class="glyphicon glyphicon-folder-open"></span> Stock Take</a></li>
                <li [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" class="nav-item"><a [routerLink]="['/settings']"><span class="glyphicon glyphicon-wrench"></span> Settings</a></li>                
            </ul>
    </div>

</nav>


my jQuery import in angular-cli.json:

"scripts": [
        "./../node_modules/jquery/dist/jquery.min.js"
      ],

Answer №1

At the moment, bootstrap 3 does not have built-in support for collapsing menu items at non-"sm" breakpoints. It seems like there may be some confusion with Bootstrap v4 classes being mixed in, such as navbar-toggleable-md.

Additionally, there is a reference to the v4 toggler using navbar-toggler and navbar-toggler-right, whereas in v3 it should be navbar-toggle and navbar-toggle-right. The colors used by navbar-light are also v4, causing the icon-bar in navbar-toggle to appear white on white without extra css.

Extra CSS

.navbar-light .navbar-toggle .icon-bar {
    background: black;
}

Updated HTML

<nav class="navbar navbar-light">
    <div class="navbar-header">
        <button class="navbar-toggle navbar-toggle-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria="navbarSupportedContent" aria-expanded="false" aria-label="toggle navigation"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
    </div>
    <a class="navbar-brand" href="#">Retail Mobile</a>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="nav navbar-nav">
            <li [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" class="nav-item"><a [routerLink]="['/home']"><span class="glyphicon glyphicon-home"></span> Home</a></li>
            <li [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" class="nav-item"><a [routerLink]="['/checkBarcodes']"><span class="glyphicon glyphicon-barcode"></span> Check Barcodes</a></li>
            <li [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" class="nav-item"><a [routerLink]="['/stockTake']"><span class="glyphicon glyphicon-folder-open"></span> Stock Take</a></li>
            <li [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" class="nav-item"><a [routerLink]="['/settings']"><span class="glyphicon glyphicon-wrench"></span> Settings</a></li>
        </ul>
    </div>

</nav>

JSFIDDLE

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

Customizing the CSS shadow for a specific ionic select text color, while ensuring that other ion select instances remain unaffected

I'm encountering an issue while attempting to customize the text color inside an ion select element based on the option selected. Unfortunately, when I make changes to the shadow part in one component, it affects other components as well. I want to ap ...

Unable to adjust the width of a label element using CSS specifically in Safari browsers

Here's the issue I'm facing with my HTML code <input type="checkbox" asset="AAA" name="assets[AAA]" value="AAA" id="assets[AAA]" class="c_green" checked="checked"> <label for="assets[AAA]"></label> In my CSS, I have the follow ...

Jquery oscillation effect

I am attempting to create a seesaw effect using jQuery, but I'm unsure about which plugin would be best for this task. The goal is to have the bar move up and down while the box on top moves in sync with it. You can find my code on JsFiddler here: htt ...

Amusing antics observed when hovering over a div in Firefox

Issue resolved, many thanks to all Here is the dilemma I am dealing with something like this <a href='http://google.com' class="buy_now" > <div class='yada yada' > Go </div> </a> buy_now changes backgro ...

Trigger a function upon window reload with the click of a single button

$('#start').click(function () { window.location.href=window.location.href; runme(); }); I have a simple goal: whenever the user clicks the start button, I want the page to reload while still executing the custom rume function. Is there a w ...

dividing a solitary string (plain text only, no HTML) evenly among three separate div containers

Recently, I encountered a frustrating dilemma. I'm trying to split a string between three divs, but they are not equal in height, so I can't divide the string based on character count. To illustrate the issue, I've created a small sketch. ...

Combine and interchange horizontal and vertical form designs within antd 5 for a personalized touch

I need to customize the layout of a form to display checkboxes in vertical mode. Specifically, there is a row of checkboxes that I want to appear vertically aligned rather than horizontally. In the past, I was able to achieve this in antd 4 by applying a ...

In order to showcase the mat-menu items underneath the mat-menu button

Currently, I am utilizing the Menu with icons component. When clicking the button (i.e., menu), the menu items (i.e., mat-menu items) are appearing above the button, as depicted in the image below. https://i.sstatic.net/KklDs.png I would like the items ( ...

What is the best way to adjust the size of an SVG image within an HTML img tag

Recently, I embarked on the journey to learn SVG and incorporate it into HTML. To get started, I created an SVG file like this: <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewbox="0 0 400 ...

What strategies can I use to dynamically update the .active class in jquery so it doesn't only target the initial one?

Utilizing bootstrap for tab-fade functionality has been successful so far. However, I am facing an issue when trying to select multiple active classes instead of just one. My current JQuery code only changes the text in the first element with the "active" ...

Tips for expanding a fabric canvas to match the entire width of its parent division

specific scenario I have a cloth canvas placed inside a main section. How can I expand the canvas to cover the entire width and height of its container? Here is what my current code looks like: <div class="design_editor_div"> &l ...

Updating information on a website

My goal is to allow users to provide input text that will dynamically replace existing text on the webpage. For example, if there is a name displayed in an HTML element, I have created a form where the user can type their own name and submit it. Once sub ...

There seems to be a display issue with the DataTables tables

Utilizing Bootstrap 4, I followed the example provided by DataTables on their website: link. The specific code that was implemented can be found here: link Take a look at how it appears: http://pastebin.com/HxSNUnLq Any suggestions on how to resolve th ...

"Exciting developments in Angular 17 with the introduction of the new @

I need to output elements from an array of strings starting at index 1. arr = [ "str1", "str2", "str3", "str4", "str5" ] The desired output is: str2 str3 str4 str5 To achieve this, use a new @for loop in ...

Display an image in a DIV by loading it from a URL provided in a TEXT BOX

I am having trouble loading an image into a div tag from a URL that is obtained from a text box. Here is my current code snippet, but I can't figure out what else needs to be done: <html lang="en"> <head> </head> <bod ...

Uneven quantities of elements in a Bootstrap grid

My website has a grid that is populated from a CMS, but I am unsure if the number of items will be odd or even. The design specifies 3 columns on desktop and 2 columns on mobile devices, with the last item centered if there is only one. I currently have t ...

Move the td cell upward by one position

I am currently working with a dynamic table that has the following structure: Here is the code for the table: table tr td LOCATIONS tr(ng-repeat="location in currentSchools.Locations") td td {{location}} Since the table is dyna ...

two inline buttons aligned in struts

Although it may seem simple, I am struggling to figure out how to align two buttons next to each other with different functions. One button is for logging in the user and the other is for signing up a new user. They are currently in two separate forms. Is ...

Switching back regular text from a superscript in document.execCommand

Currently, I'm developing a customized text editor that utilizes a contenteditable div with some basic formatting features. To enable superscript functionality, I'm employing the command document.execCommand("superscript", false, undefi ...

RSelenium: Issue with extracting hyperlinks from webpage following button click操作

My goal is to automate web scraping with RSelenium in R. I've managed to find and click a button on a webpage using RSelenium, but I'm struggling to extract href attributes from the page after clicking the button. Although I have a list of 4000 ...