When Hovering Over Bootstrap Navigation Submenus, They Disappear with Mouse Movement

How can I prevent my Bootstrap navigation bar with a dropdown subnav from disappearing when I try to move my mouse down to the subnav? I want it to stay visible even as I move downwards. Any tips on achieving this for desktop only?

Thanks!

Visit this link for reference

li.dropdown:hover>.dropdown-menu {
  display: inline;
}

.dropdown-menu {
    background-color: black !important;
  border: none !important;
  border-radius: 0px !important;
}

.dropdown-item {
    color: white !important;
  display: inline !important;
  padding: .25rem 0.75rem !important;
  line-height: 2.5rem;
}

.dropdown-item:hover{
  background-color: transparent !important;
  color: #FFB703 !important;
}

.mlauto1 {
  float: right;
  margin-right: 8px;
}

nav {
  line-height: 2.5rem;
}


@media (min-width: 768px) {
  li.dropdown.scale > .dropdown-menu {
    display:block;
    opacity: 0;
    -o-transform: scale(0);
    -ms-transform: scale(0);
    -moz-transform: scale(0);
    -webkit-transform: scale(0);
    -o-transform-origin: 0% 0%;
    -ms-transform-origin: 0% 0%;
    -moz-transform-origin: 0% 0%;
    -webkit-transform-origin: 0% 0%;
    -o-transition: -o-opacity 1.0s;
    -ms-transition: -ms-opacity 1.0s;
    -moz-transition: -moz-opacity 1.0s;
    -webkit-transition: -webkit-opacity 1.0s;
  }



  li.dropdown.scale:hover > .dropdown-menu {
    opacity: 1;
    -o-transform: scale(1, 1);
    -ms-transform: scale(1, 1);
    -moz-transform: scale(1, 1);
    -webkit-transform: scale(1, 1);
  }
<!DOCTYPE html>
<html lang="en">

<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>

<body>
  <nav class="navbar navbar-full navbar-expand-lg navbar-light bg-light">
    <a class="navbar-brand" href="#">Brand</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto">
         <li class="nav-item dropdown scale position-static" id="parent">
          <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            solutions
          </a>

          <div class="dropdown-menu w-100" aria-labelledby="navbarDropdown">
                       <div class="mlauto1">
            <a class="dropdown-item mx-auto" href="#">subnav</a>
            <a class="dropdown-item" href="#">subnav</a>
            <a class="dropdown-item" href="#">subnav</a>
            <a class="dropdown-item" href="#">subnav</a>
                        <a class="dropdown-item" href="#">subnav</a>
                        <a class="dropdown-item" href="#">subnav</a>
            </div>
          </div>
        </li>
        <li class="nav-item active">
          <a class="nav-link active" href="#">our story</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">work</a>
        </li>
       
      </ul>
      
    </div>
  </nav>

</body>
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
</html>

Answer №1

Solved it on my own!

I was able to fix the issue by removing margins and padding from the hover element and dropdown menu. I also added a hover class directly to the dropdown to guarantee its visibility.

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

Personalized Bootstrap 4 navigation bar tailored specifically for the application process

Seeking a customized progress nav-bar for my application, with a design similar to this: https://i.sstatic.net/ahDBa.png Discovered it on this website. Despite using the provided HTML and CSS, I'm unable to make it work with Bootstrap 4. HTML < ...

Could you provide guidance on how to toggle the visibility of a div using the click event of a button or link located on a different HTML page in Angular?

Is there a way to change the visibility of a div on a different page when a button or link is clicked? For example, I have a button on the "main.html" page that, when clicked, should display a hidden div on the "header.html" page. How can I achieve this? ...

Tips for customizing the appearance of a jQuery sortable target list prior to dropping items

When using jquery sortable, I am able to customize a placeholder inside a connected list specified in the connectWith option to visualize where the content will be dropped. However, I am struggling to find a way to style the actual list that contains the p ...

Using a pseudo-element after to center CSS content

Although there are numerous posts discussing this topic, my situation is unique. In my case, I have a collection of colors represented by circles. When I click on a circle, I add content in the form of a check mark by including a class selector with an af ...

AngularJS Treeview with Vertical Line Styling using CSS

Struggling with styling, I am attempting to create a tree view in AngularJS. Currently, I am facing an issue aligning vertical and horizontal lines for the tree items. Check out my Codepen for reference. <html lang="en"> <head> <meta cha ...

What is the best way to determine the height of an element after new content has been added through AJAX?

I have been working with a Jquery Mobile page and I am facing an issue when loading a form via AJAX. The plugin I am using to set the page dimensions calculates them after the AJAX call has completed and the layout has been updated. However, the height of ...

The alignment of my card icons changes depending on the size of the paragraph

Here are my cards I am attempting to give them a relative position and the parent div an absolute position, but it is not working as expected. Despite several attempts, I still cannot get the desired result of positioning the cards correctly within the p ...

Interactive Bootstrap 4 Navbar Dropdown with Click and Hover Functionalities

Last month, I was faced with the challenge of creating a Bootstrap 4 navigation bar with a dropdown feature that displayed a +/- button on small devices. Thanks to the assistance I received here, I was able to resolve it. However, I have encountered a slig ...

Reorganize items that extend beyond the list into the next column using Bootstrap

I have a row with two columns, where Column 1 currently contains 7 list items under the ul tag. However, I want to display only 5 list items in Column 1 and automatically move the remaining items to the next column (i.e., Column 2). Is there a way to ach ...

Event handler for the MouseLeave event is not successfully triggering when dealing with anchor

When viewing a link to a Codepen, the issue is most noticeable in Chrome: https://codepen.io/pkroupoderov/pen/jdRowv Sometimes, the mouseLeave event fails to trigger when a user quickly moves the cursor over multiple images, resulting in some images reta ...

Customize your Bootstrap tabs with a unique border design

I am currently working on a wizard project where the header design is inspired by the image below. I am utilizing Bootstrap-4 tabs components and the :after pseudo element method on the li element to achieve this effect. However, I am facing a challenge in ...

In JavaScript, what's the best way to conceal options that have not been clicked on? Can this be achieved by setting their display property

<div class="payment-method"> <div class="method-menu" id="method1"> <input type="radio" name="payment-method" value="credit-card"> <img src="images/credit.png" width="45" height="45" alt=""/><div class="method-text"></div& ...

Issue with firing button click event in Node Express when using Bootstrap

Beginner in Node and ExpressJs, currently developing a Nodejs app using ExpressJS and Bootstrap with the following setup: Developing in VSCode. Tools: utilizing npm to install express and npm init to create the project Issue: Upon clicking the btnLogin ...

Position the text alongside the Facebook emblem

I am having trouble getting the text Follow Us to align on the far right next to the Facebook Icon. I added the float:right property, but it is not working as expected. Here is the code snippet: <a href="#" target="_blank" style="font-family: Arial, ...

Creating a stunning image fade-in effect with CSS3

I have been working on a way to make images fade in using CSS3 once they have finished loading. However, I am facing an issue where the image fades in and out for a brief moment twice instead of just being blank and fading in. My attempt at a solution inv ...

CSS: Experimenting with creating a hover effect that lifts the box upwards

Hey there! I'm currently working on adding a red hover box for my Menu. The issue I am facing is that the hover box is displaying below the menu line. I am attempting to adjust the hover box to move a bit higher or up. You can view the image here: ht ...

Responsive design in Bootstrap(-Vue) with compact input fields

I am currently working on creating an input form with small fields and signs between them. https://i.sstatic.net/THjhs.png Right now, I am using a combination of classic HTML and Bootstrap-Vue, as shown in the screenshot. It is functional, but the issue ...

Bootstrap does not toggle the menu

My menu won't open when clicked and I can't figure out why. I've searched through various posts on StackOverflow and other websites, but still haven't found a solution. I may be new to Bootstrap, but I'm eager to learn. <link ...

Overflowing container due to text in Material UI Accordion heading

While using the Material UI accordion, I have encountered an issue within the AccordionSummary component where the title should be displayed. I have created a flex layout with two flex items inside. The first flex item contains the accordion title, while ...

Mobile Safari is having troubles loading CSS

After a long time of using in-line CSS directly on the page, I finally decided to consolidate it all into one file for my own sanity. Initially, I attempted the standard <link rel="stylesheet" href="URL"> approach and it loaded successfully, alt ...