The mobile version of Bootstrap v3.3.6's drop down submenu items fails to expand properly

I have been working on a website using Angular 1, Bootstrap, and CSS3. The Bootstrap navbar functions perfectly in desktop mode, but the submenu is not working in the mobile version. I am able to expand the main menu item, but the three submenus are not visible at all. I have been struggling with this issue for three weeks now and cannot seem to resolve it. The website is essentially a single-page application with Angular routing logic.

Bootstrap version: 3.3.6

You can visit my website www.europeansaga.com to see the issue in mobile mode.

Below is the code along with HTML and JS models containing the menu data

// JavaScript code inside my controller

$scope.mainMenu = [{

name: 'Home',
hasChild: false,
iconClass: 'glyphicon glyphicon-home',
url: '/'
}, {

name: 'Gallery',
hasChild: false,
iconClass: 'glyphicon glyphicon-camera',
isActive: false,
url: '/gallery'
}, 
// Rest of the menu items omitted for brevity

$scope.submenu['Travel Planning'] = [];
for (var i = 0; i < travelPlanningSubMenuItems.length; i++) {
$scope.submenu['Travel Planning'].push(travelPlanningSubMenuItems[i]);
}
// Rest of the submenu items populated in a similar manner

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
// Navbar structure code omitted for brevity
</nav>

Mikkel suggested placing the following code inside document.ready as a CSS class onclick. However, even after implementing this, the issue persists. Can someone provide assistance? Unfortunately, I cannot share the website due to this major issue I am facing.

// Patch for bootstrap hamburger menu
$(".navbar-responsive-collapse").click(function(e) {
if ($(e.target).is('a')) {
$(this).collapse('hide');
}
});

Answer №1

Here's a quick solution that I implement in my own work to address this issue. Apologies for the time wasted trying to resolve it.

// Fix for bootstrap hamburger menu
$(document).on('click', '.navbar-collapse.in', function (e) {
    if ($(e.target).is('a')) {
        $(this).collapse('hide');
    }
});

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

Exploring the power of ui-router in conjunction with ngAA in AngularJS

app.js var app = angular.module("ng-app",[ 'ui.router', 'oc.lazyLoad', 'ngMaterial', 'ngAnimate', 'ngMessages', 'ngAria', 'ngAA', 'ngRoute', 'n ...

AngularJS failing to load controller for my specific scenario

Whenever I try to load my controller, I keep getting an error. I have double-checked all my files, but I can't seem to figure out where the mistake lies. Can anyone help me with this? This is my html file: <!DOCTYPE html> <html ng-app="tcp ...

I'm not entirely sure how JQuery processes the .each() function and the (this) keyword

I'm still learning JQuery and trying to figure it out. Can you help me understand what's going wrong with my code below? I have multiple content blocks with classes .acc-0, acc-1, and so on. I want to show and hide the .plans-breakdown when the ...

The most recent version of Angular featuring the powerful Angular-anim

Currently, I am in the process of revamping an application that was initially developed using a combination of jquery, bootstrap, and kendo ui. Moving forward, the application will transition to an angular (2/4) and kendo framework. In the previous setup, ...

scrolling malfunction

I encountered a problem with the scroll feature in this image: The problem is that I only want the vertical scroll to show up, not the horizontal scroll. I tried using the overflow:scroll attribute in my code. Will it display the same in Firefox and IE, o ...

What is the best way to switch between two icons using boot-strap and jQuery without the use of buttons?

Is there a way to make it so that clicking on the heart icon hides it and shows the filled heart icon instead using jQuery? I am struggling to figure out how to reference the other icon in my function. This is just a rough idea of what I want to achieve. ...

What is the process for modifying CSS in Laravel?

New to Laravel over here, currently working in Homestead. When I need to make changes to my CSS, I typically edit the app.scss file located in resources/assets/sass and then recompile the css with Mix using the command npm run dev. I'm not entirely ...

Padding-left in InfoBox

Currently, I am in the process of developing a map using Google Maps API3 along with the InfoBox extension available at this link I have successfully implemented an overall padding to the Infobox using the following code snippet: var infoOptions = { disa ...

combine a pair of elements simultaneously

I recently developed a nested directive for a multitabbed form, and here is a simplified version: <outer> <inner heading="a" src="'a.html'" active="true"></inner> <inner heading="b" src="'b.html'"></inner ...

Tips for creating sliding header content alongside the header

Is it possible for the content in the header to scroll up, displaying only the navigation list and hiding the logo when a user scrolls on the website? Currently, while the header background slides up, the content within the header remains in place. I feel ...

live preview of row data in a thumbnail

I'm curious about creating dynamic thumbnails of logos from table rows, similar to the image below: https://i.sstatic.net/FooEz.png Here is the code I've been using: .numberCircle { border-radius: 50%; width: 30px; height: 30px; padd ...

Setting a static width for a specific cell in HTML5 - What's the best way to go about it?

When working with HTML5, how do I define a specific width for a table cell? Many of the <col> properties that were present in HTML4 are no longer applicable in HTML5. Just to clarify, I am aware that I can use <td style="width:150px">, but thi ...

javascript/jquery - steps to design an effective modal page overlay

Struggling for the past few weeks to create a modal dialog using javascript/jQuery. While iOS and Android devices seem to work fine, Windows mobile/Opera mobile often present issues with the modal size. It either requires excessive scrolling or ends up bei ...

Troubleshooting Variances in CSS Layouts on Different Devices

I have been wrestling with a challenging question regarding CSS layouts, and I believe it's time to seek advice from those who may be more knowledgeable in this area. Let's discuss why my current layout is presenting such a headache. Take a look ...

Toggling javascript functionality based on media queries

On one of my slides, I want to display images that are specific to different devices like iPhone, iPad, and desktop. I am looking for a way to filter these images based on the device. Using display:none won't work as it's JavaScript, but here is ...

Customizing the hover behavior of a div element without causing displacement of surrounding elements

I am facing an issue where the descriptions in my list of 100 items are longer than the width of the div, causing the text to be cut off. I want to display the full description on hover without affecting the layout of other items. Currently, when I hover o ...

Error in Taiwlind CSS: Styles are not loading in production environment but are working fine in development environment. This issue is encountered while using Next.js in

After reading various blog posts online, I put together this code snippet. The confusion arises from blogs using autoprefixer while others use postcss-preset-env. In my setup, I have added tailwindcss as a development dependency and properly imported the ...

What causes a div with an image inside to not expand the height of its parent div?

I'm puzzled as to why the mainCountainerHeadLogo isn't expanding the parent div, mainCountainerHead, in terms of height. Interestingly, when I adjust the page scale, both mainCountainerHeadTitle and mainCountainerHeadMenu do expand the mainCount ...

Only the style attribute will support React CSS animations

After developing a component that changes its className based on the state, I discovered that animations only function properly when placed within the "style" attribute. In my Codesandbox project, by uncommenting line 15 in the code snippet provided, the ...

Emphasize the content within the table cell

Currently, I am working with an HTML table that is being generated by Java. My goal is to highlight the text within a table cell without changing the background color of the entire cell. I should mention that I am aware of the option to achieve this by ma ...