CSS Navigation drop-down menu experiences a shaking problem when the mouse hovers between the first and second link

Hey there, I'm experiencing a strange issue with my navigation bar. When hovering the mouse between the first drop-down link and the second drop-down link, a strange jitter occurs.

Can someone provide assistance in resolving this issue?

You can witness it happening at this link.

I've attempted to add margins and padding to the li element, but it doesn't seem to help. There is always an intersection between menu item 1 and menu item 2 that causes both menus to try and open, resulting in a jittery effect.

Below is the code snippet:

<!DOCTYPE html>
<html>
   <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width">
      <title>Strange Navigation Issue</title>
      <style>
         .main-nav {
         }
         .main-nav,
         .main-nav * {
         margin: 0;
         padding: 0;
         list-style: none;
         }
         .main-nav > ul > li {
         position: relative;
         white-space: nowrap;
         float: left;
         }
         .main-nav a {
         display: block;
         position: relative;
         color: #413e66;
         padding: 10px 15px;
         transition: 0.8s;
         font-size: 14px;
         font-family: "Open Sans", sans-serif;
         text-transform: uppercase;
         font-weight: 600;
         }
         .main-nav a:hover,
         .main-nav .active > a,
         .main-nav li:hover > a {
         color: #1bb1dc;
         text-decoration: none;
         }
          .......... (the rest of the CSS code continues)
      </style>
   </head>

   ......(the rest of the HTML code continues here)

</body>
</html>

Answer №1

The issue lies in the way your dropdown menus are behaving. They drop below your cursor when you move it back into place, causing them to activate again.

To prevent this, you can modify the following rule:

.main-nav .drop-down ul { padding: 0;}

(The width of your dropdown was too large. It should not exceed the width of its parent container, otherwise it will extend beyond your cursor)

Another problem arises when the second level of dropdowns is activated and quickly deactivated as you hover over the menu with your cursor at the bottom right of the container. This issue occurs for the same reason - the first dropdown extends past the cursor, triggering the second dropdown to open and close rapidly due to the movement. One possible solution could be to hide the first dropdown behind the menu to prevent accidental hovering by the cursor.

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 button groups with a centered .btn using Bootstrap 4

My button group has a link in the middle, so it needs to be an a tag. I could change it to a button and use JavaScript for navigation, but I'd prefer not to. Here is the code: <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bo ...

Bootstrap 3 offset doesn't respond to dimensions

Even though I have set an offset for a medium-sized screen, the offset still appears in large screens. Here is a snippet of my HTML code. How can I resolve this issue? <div class="col-lg-6 col-sm-12"> <div class="row"> <div class="co ...

Is there a way to delete both the item and its corresponding key from localStorage?

I have developed a basic application that utilizes localStorage for saving and deleting data. However, I encountered an issue where deleting an item only removes the value but not the key. As a result, when loading all items, the deleted ones appear as nul ...

Modifying the order of Vuetify CSS in webpack build process

While developing a web app using Vue (3.1.3) and Vuetify (1.3.8), everything appeared to be working fine initially. However, when I proceeded with the production build, I noticed that Vue was somehow changing the order of CSS. The issue specifically revol ...

Increase the height of items in a top navigation bar in proportion to the height of the logo

Does anyone have a solution for how to make the links inside the div.topbar take up the full height of the container, especially when they are hovered over? I've extracted this specific feature and shared it [here][1]. I'm not sure if there&apos ...

Encase children within a view component in React Native

I've been working on the following code: renderActionButtons(actionButtons){ let actionButtonsContent = actionButtons.map((button, i) => { return <TouchableHighlight key={i} onPress={() => {this.updateConversation(button);}} style= ...

When utilizing the "as" attribute, styled components do not inherit any styles

I am currently utilizing both styled-system and styled components, working on a simple scenario like the one below: const buttonFont = { fontFamily: "Chilanka" }; // define basic text styling const Text = styled.div` ${typography} ${color} `; // c ...

How can I make $.when trigger when a JSON request fails?

I am currently using the code below to retrieve JSON data from multiple URLs. However, I have noticed that if one of the URLs fails or returns a 404 response, the function does not execute as expected. According to the jQuery documentation, the "then" fu ...

How to Generate HTML Reports Using JBoss?

Is there a convenient and efficient way to generate .html reports for JBoss applications that is not time-consuming? I have a database containing entities that I need to display in multiple tables. The report should include links to navigate between secti ...

Utilize Python Selenium to interact with Cookie-Consent pop-ups

Attempting to scrape a webpage using Python and selenium, but encountering difficulty when trying to click the "OK" Button for cookie consent as it cannot be located: View Picture of Consent Dialog Visit Website Here This locator works: driver.find_eleme ...

Shifting image from center to corner as you scroll

Hello there, I'm new to this so please bear with me for any obvious mistakes, thank you :) My goal is to have an image move from the center of the screen to the corner of the screen as you start scrolling. I've made some progress on this, but I& ...

Custom HTML structure for WordPress navigation menu - WP Nav Menu

Need help creating a customized Wordpress Menu with HTML structure: <?php wp_nav_menu( array( 'theme_location' => 'global-menu' ) ); ?> The desired HTML output should resemble the following: <nav> < ...

Tips for automatically scrolling to the bottom of a div when new data is added

I'm working on a project with a table nested inside a div, and it has some unique styling: #data { overflow-x:hidden; overflow-y:visible; height:500px; } Currently, as the table fills up with data, a vertical scroll bar appears. But I wa ...

Issue with IE11 when using Bootstrap 4 and Flexbox

In my design, I have two columns that need to have equal heights when displayed next to each other on a large screen. However, on mobile devices, they should stack on top of each other. I am currently using the old BS grid for this layout. The content wit ...

Arrange the <form:radiobuttons> in a vertical position

I'm currently utilizing Spring MVC's <form:radiobuttons> to showcase radio buttons: <form:radiobuttons path="selection" items="${arraySelection}" /> The issue I am facing is that it is displaying the radio buttons in a horizontal la ...

Ways to overlook concealed elements within a Bootstrap Button Group

Within my button group, there are 10 buttons. On certain screen widths, using media queries for responsiveness, I hide some buttons. The issue arises when the last button is hidden - the rounded edges of the succeeding visible button are not maintained. ...

What's the best way to eliminate blank space in my Bootstrap grid columns?

I'm facing an issue with the search filter layout on my website. It includes input fields for a search term, two datepickers, and two buttons: <div id="search-holder"> <div id="search-box"> <div ...

Searching for image labels and substituting the path string

Upon each page load, I am faced with the task of implementing a script that scans through the entire page to identify all image src file paths (<img src="/RayRay/thisisianimage.png">) and then add a specific string onto the file paths so they appear ...

Adjust the navigation text and logo color as you scroll on the page

I am new to HTML and CSS and I am working on a website with PagePiling.js scrolling feature. I want to change the color of my logo image and navigation text dynamically as I scroll to the next section. Specifically, I only want the part of the logo and tex ...

What could be causing the Javascript Dynamic HTML5 Table to not display on the page?

I have a program that calculates the total price of products based on a specified quantity and updates an HTML table with these values. To demonstrate this, I am constantly taking input using an infinite loop. <!DOCTYPE html> <html> ...