Menu rollout problem when clicking or hovering

I'm facing challenges in making my menu content appear when a user clicks or hovers over the hamburger menu. My app is built using Angular, and I've written some inline JavaScript and CSS to achieve this, but the results are not as expected. Here's a screenshot showing the issue:

My code can be found below:

<!doctype html>
<html ng-app="mbapp">
  <head>
    <meta charset="utf-8">
    <title>Cloud + Enterprise // Moneyball Tools</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">
    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->

    <!-- build:css({.tmp/serve,src}) styles/vendor.css -->
    <!-- bower:css -->
    <!-- run `gulp inject` to automatically populate bower styles dependencies -->
    <!-- endbower -->
    <!-- endbuild -->

    <!-- build:css({.tmp/serve,src}) styles/app.css -->
    <!-- inject:css -->
    <!-- css files will be automatically inserted here -->
    <!-- endinject -->
    <!-- endbuild -->
    <base href="/">  
    <link href="app/styles/mbapp.css" rel="stylesheet" /> 
 <style type="text/css">
    li > .sideCont > a {
        text-decoration: none;
    }
    li > .sideCont > li a: hover {
        text-decoration: none;
        color: inherit;
    }    

    .menu_items_toggle {
        opacity: 1 !important;
        top: 100% !important;
    }

    #menu {
        position: relative;
    }
    #menu_items {
        position: absolute;
        top: 0%;
        opacity: 0;
        transition: all 0.5s;
    }
    .menu_items_toggle {
        opacity: 1 !important;
        top: 100% !important;
    }
</style>
  </head>
  <body style="background-color: #f5faff;">
    <div class="container-fluid" style="font-family: Segoe UI; padding: 0;">
        <div id="menu" style="background-color: #002F33; min-height:50px;">
            <span id="span_img_container" class="navIcon" style="width: 50px; border-right-style: solid 1px #939393;"><img id="menu_img" src="assets/images/icon_hamburger.png"></span>
            <div id="menu_items">
                <a href="https://www.moneyball.ms/">Moneyball Website</a>
                <br>
                <a href="https://www.tools.moneyball.ms/">Moneyball Tool</a>
                <br>
                <a href="https://msit.microsoftstream.com/channel/8a4a7740-855b-4c52-912c-c97fb714a0a6">Moneyball Stream Channel</a> 
                <br>
            </div>
            <span style="color: #ffffff; font-size: 22px; padding-left:20px; padding-top: 21px;">Moneyball Tool</span>> 
        </div>
        <div class="col-md-2 tabNav">
            <ul class="tabTitle">
                <p>Project tools</p>
                <li class="tabCont"><a href="#/home">Welcome</a></li>
                <li class="tabCont"><a href="#">Experiments</a></li>
                <li class="tabCont"><a href="#">Interview Notes</a></li>
            </ul>
            <ul class="tabTitle">
                <p>Hypothesis worksheets</p>
                <li class="tabCont"><a href="/#/steps">Problem phase</a></li>
                <li class="tabCont"><a href="/#/solutionHyp">Solution phase</a></li>
                <li class="tabCont"><a href="#">Service phase</a></li>
                <li class="tabCont"><a href="#">Growth phase</a></li>                
            </ul>            
        </div>
        <div ui-view>
        </div>
    </div>

    <script type="text/javascript">
        //make a refernce to the container that holds all your links
        var menu_item_container = document.getElementById("menu_items")

        //This function will show/hide menu options if image is clicked on
        function clicker() {
            menu_item_container.classList.toggle('menu_items_toggle');
            console.log(menu_item_container.classList.contains('menu_items_toggle'))
        }
        console.log(document.getElementById("span_img_container"));
        document.getElementById("menu_img").addEventListener('click', clicker)
    </script>

    <!-- build:js(src) scripts/vendor.js -->
    <!-- bower:js -->
    <!-- run `gulp inject` to automatically populate bower script dependencies -->
    <!-- endbower -->
    <!-- endbuild -->

    <!-- build:js({.tmp/serve,.tmp/partials,src}) scripts/app.js -->
    <!-- inject:js -->
    <!-- js files will be automatically insert here -->
    <!-- endinject -->

    <!-- inject:partials -->
    <!-- angular templates will be automatically converted in js and inserted here -->
    <!-- endinject -->
    <!-- endbuild -->

  </body>
</html>

Answer №1

The issue at hand is that the menu on your page is covering up the "hamburger menu". This occurs when elements are set to be non-clickable with the CSS properties display: none; or pointer-events: none;.

To resolve this problem, you can make the following adjustments:

#menu_items.menu_items_toggle {
  opacity: 1;
  top: 100%;
  display: inline-block;
}

It's important to note that I included an id (#menu_items) in the selector to increase the specificity of the CSS rule, thus avoiding the use of !important.

In your menu_items styles, remember to include display: none;.

#menu_items {
  position: absolute;
  top: 0%;
  opacity: 0;
  transition: all 0.5s;
  display: none;
}

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

Validation messages in an Angular application using Typescript are failing to display or disappear sporadically when applied to an HTML form that has

I am currently working on a simple app that retrieves website content from a CMS [Umbraco]. After making an Ajax call, the form comes back to me as plain HTML. I then append the form to the page and use the Angular $compile service to compile the result. T ...

Filtering Array Elements with AngularJS Repeater

Can I customize my ng-repeat to filter through an array or object? Currently, I am populating via an http request like this: <div class="ibox" ng-repeat="data in appraisals track by $index"> However, I am wondering if there is a way to apply a fi ...

Angular JS causing text alignment issues in table cells when viewed on mobile devices

I have created a web application that requires both desktop and mobile views, utilizing Angular JS. Everything is functioning as expected except for the text alignment within tables. I attempted using <td align="left">, but it did not produce any cha ...

Attempting to create an auto-suggestion tool that can process and accept multiple input values, filtering out only those that begin with a designated character

I've been working on implementing an auto-suggestion feature that displays suggestions with partial matches or values within the input box. The goal is for it to only provide suggestions that begin with a specific character, like the "@" symbol. Fo ...

Verifying the visibility status of a div and toggling a class based on it

I'm facing a challenge with multiple checkboxes in a row. When a button is clicked, it displays a div (#locale_container), and flips a small arrow by adding a rotated class. However, I only want the arrow to flip when the div is being shown or hidden ...

Displaying a loading template within an Angular component

While reviewing some code in AngularJS version 1.2.22, I came across the following snippet in the HTML: <div class="mainContent" ng-include="content"> </div> Within its corresponding controller, I found this: $scope.content = 'templates ...

Is it possible to eliminate jagged edges in CSS 2D rasterization by applying anti-aliasing to subpixels?

It appears that the HTML/CSS engine automatically rounds values to the nearest whole px unit. It would be interesting to see non-discrete sizing options (floats). A closer look reveals that in Chrome, widths/heights are rounded to the nearest physical pix ...

Modify the size of a div based on the status of a checkbox using only HTML and CSS

Here is a small project that I created using only HTML & CSS. The goal is to modify the properties of the <div class="pro"> when the checkbox is checked. When this happens, all other <div class="pro"> elements should be hidden and the <art ...

Dynamic HTML text colors that change rapidly

I have an interesting question to ask... Would it be possible to create text that switches between two colors every second? For example, could the text flash back and forth between red and grey? I don't mean changing the background color, I mean act ...

Efficiently uploading multiple files using AJAX in conjunction with Codeigniter

Greetings! I'm attempting to utilize ajax and codeigniter to upload multiple images. As a beginner in ajax and jquery, I would greatly appreciate any assistance in identifying where I might be going wrong or missing something. Below is my controller ...

Is there a way to turn off vue.js transitions specifically for testing purposes?

I'm utilizing a vue.js component with the <transition> element for show/hide animations. However, I want to disable the animation for faster testing. How can I achieve this? The solution proposed is * { transition: none !important } in this lin ...

Setting up SSL/TLS certificates with Axios and Nest JS

I have a Nest JS application set up to send data from a local service to an online service. However, the requests are not working because we do not have an SSL certificate at the moment. Can anyone provide guidance on configuring Axios in Nest JS to accept ...

integrating the WordPress header into the WHMCS client portal

While working on a project, I am facing the challenge of aligning the WHMCS client area with my WordPress site. Progress has been made, but I have hit a roadblock. My goal is to integrate the header of my WordPress site into WHMCS. I initially attempted t ...

Deploying NextJs application with Firebase's static site generation (SS

TL;DR The new data I add to my project is not displaying on the site, even though it's in the database. The issue arises after deploying with Firebase. I created a meetup website using Firebase as the backend. Everything works fine in development mo ...

AngularJs throw an error when trying to use $q which is not defined on the console

Encountering an error message in the console stating $q is not defined. After doing some investigation, it appears that the .q library has been deprecated as mentioned on If this information is accurate, then it implies that the entire concept of promises ...

invalid audio element

I'm currently working on building an audio player with a visualizer feature. However, when I try to initiate the audio player by clicking on the input button, my debug console keeps showing this error message: Uncaught (in promise) DOMException: Fa ...

Automatically scraping Facebook API data with PHP

I'm completely new to php and I am looking for a way to automatically scrape metadata. I came across a solution, but I am unsure how to implement it in php. POST /?id={object-instance-id or object-url}&scrape=true Can anyone provide a sample php ...

Spring-boot application having trouble locating index.html

I am in the process of connecting an AngularJS and spring-boot application for the first time manually. I'm encountering an issue where my @RestController is not returning the index page: @RestController public class IndexController { @RequestMa ...

Node Js seems to be taking quite a while to output to the console

Hello, this is my first time posting on Stack Overflow so please bear with me if I make any mistakes. I created a button that, when clicked, decrements the quantity by one. After updating the UI, I send the data to the server. However, when I console log t ...

Using ngFor directive to iterate through nested objects in Angular

Receiving data from the server: { "12312412": { "id": "12312412", "something": { "54332": { "id": "54332", "nextNode": { "65474&q ...