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:

https://i.sstatic.net/gR4Vj.png 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

Press the button to switch between displaying one component and hiding another component within reactjs

I am working on a project with two distinct buttons: one for grid view and another for list view. <button onClick={() => setClassName('jsGridView')} title="Grid View" > <IoGrid className="active" s ...

sending a parameter in the reverse url using JavaScript

coding in javascript let address = '{% url candidate_resume "cnd_id" %}'; address = address.replace("cnd_id",id); document.getElementById('cell2').innerHTML= '<a href="' + address + '"> View Resume < ...

What is the best way to implement this header style with code?

I came across this design from a potential client recently, even though we didn't end up working together. I thought it would be a good exercise to try coding the design for practice purposes. Just to clarify, this is not my original design and I have ...

Creating a seamless and interactive online platform

I am in the process of designing a website that has a sleek and dynamic layout, rather than just a static homepage. Let me explain further: Here is my current setup so you can understand what I am trying to achieve. By dynamic, I mean that when the page ...

Exploring the combination of PHP and HTML through conceptual sessions

I am a beginner in the world of PHP, HTML, and website development, and I am currently trying to grasp the concept of Sessions. My goal is to implement a login/logout feature on a website using sessions, MySQL, and Slim framework. I am struggling with und ...

Breaking down numerous requests into chunks in JavaScript: A step-by-step guide

I am facing a situation where I have multiple requests to make, but they cannot all be called simultaneously. Therefore, I came up with a solution to split the set of requests into chunks of 10. I'm curious about how I can handle making these 10 reque ...

Adjust the max-height to occupy the entire available space

One of the challenges I'm facing with my web application is designing the layout in a way that all elements interact seamlessly. The structure is as follows: <body> <nav> <-- top navigation bar <ol> <-- breadc ...

Incorrect Zooming Behavior in HTML and CSS

Currently, I find myself on a website layout where the banner remains fixed at the top of the page while allowing scrolling for the inner div. However, when I zoom in using the browser (ctrl+'+'), the banner overflows the container without making ...

Obtain a list from a Python code within an HTML page that has been web scraped

As a beginner in web scraping, I encountered a minor obstacle while working with the code below: import requests from bs4 import BeautifulSoup url = "www.website.com" page = requests.get(url) soup = BeautifulSoup(page.content, "html.parser") price_scripts ...

"Utilizing Trackball controls, camera, and directional Light features in ThreeJS version r69

I am struggling to synchronize trackball controls and camera with the directional light. Here is my situation: I start by initializing an empty scene with a camera, lights, and controls. Then, I load a bufferGeometry obj, calculate its centroid, and adjus ...

Tips for creating a div that covers the entire screen and prevents it from resizing

I am facing an issue with a container having the className "container". When I set the height to 100vh like this: .container{ height:100vh } Whenever I resize my screen, such as with dev-tools, the div also shrinks. How can I prevent this? Is it possi ...

What could be causing the issue with script.onload not functioning properly in a Chrome userscript?

I am trying to use a userscript to load another script file on a website. However, I am encountering issues with the js.onload event not working as expected. Here is the userscript file: // ==UserScript== // @name Code highlight // @description ...

React-Native-SVG encountered an error: Invariant Violation - the component "RNSVGGroup" could not be found in the UIManager

Trying to create an SVG in React-Native using react-native-svg. I have set up a React-Native-CLI. After doing some research, I attempted to solve the issue on my own and found something useful. I tried running cd ios && pod install. I wasn't ...

Coordinating HTTP POST requests to an API using Angular

I've been facing a challenge trying to synchronize my POST requests to an endpoint using Angular. While I found some examples of synchronized GET requests, applying the same concept to POST requests has proven to be quite tricky. From my perspective ...

Harnessing conflict in HTML with various versions of jQuery can be a powerful tool for enhancing the

Is it possible to use 2 different jQuery libraries on the same HTML page? I came across some blogs mentioning conflicts, but when I tried to add them both, I had no luck. Can anyone assist me with this? Here is my code: Product slider <link hre ...

Exploring HTML and CSS backgrounds

I am new to CSS and I have a question regarding design. I want to create a form in the center of my webpage (shown as the black box) with a white background that overlaps the body background (represented by the red lines). For reference, please view this ...

Extracting the nearest tag for a specific element by utilizing text containment in Selenium with Java

Is there a way to fetch the tag under which the text is visible without selecting parent elements that contain the same text when using getTagName for all tags? <ul> <li> The Text </li> </ul> In the example above, if we use contain ...

Can TypeScript and JavaScript be integrated into a single React application?

I recently developed an app using JS react, and now I have a TSX file that I want to incorporate into my project. How should I proceed? Can I import the TSX file and interact with it within a JSX file, or do I need to convert my entire app to TSX for eve ...

Unspecified variables in a Javascript bot

Currently, I am working on a project involving the Kik API to create a bot. The main goal is for the game to initiate when users type "!hangman". A boolean value called hangman activates this process and then becomes inactive. Players can then input "!ha ...

Efficiently Loading AJAX URLs using jQuery in Firefox

setInterval(function(){ if(current_url == ''){ window.location.hash = '#!/home'; current_url = window.location.hash.href; } else if(current_url !== window.location){ change_page(window.location.hash.split('#!/&apo ...