Is there a problem with the drop-down menu not closing on WordPress?

I have successfully implemented a transition effect for the dropdown menu in my custom WordPress theme. However, I am facing an issue where the transition effect does not appear when the cursor moves away from the dropdown menu while closing. To see this in action, you can visit my theme here.

Here is the CSS style for the dropdown:

.dropdown-menu {
    border-bottom-right-radius: 77px;
    border-bottom-left-radius: 77px;
    /* background: url(img/submenu.png) no-repeat scroll right/ 91% 100%; */
    position: absolute;
    height:0;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    float: left;
    min-width: 153px;
    padding: 1px 0;
    margin: 2px 0 0 0;
    list-style: none;
    font-size: 14px;
    text-align: center;
    background-color: transparent!important;
    border: 1px solid #ccc;
    border: 1px solid rgba(0,0,0,0.15);
    background-clip: padding-box;
    opacity: 0;
    top: 35px;
    visibility: hidden;
    -webkit-transition:height 300ms ease-in;
    -moz-transition:height 300ms ease-in;
    -ms-transition: height 300ms ease-in;
    -o-transition:height 300ms ease-in;
    transition:height 300ms ease-in;
    overflow: hidden;
}

.navbar-nav li:hover .dropdown-menu {
    opacity: 1;
    top: 105px;
    visibility: visible;
     height:300px;
}

How can I add a transition effect for the dropdown menu when it is closing?

Answer №1

Instead of solely transitioning the height, consider:

-webkit-transition: all 300ms ease-in;
-moz-transition: all 300ms ease-in;
-ms-transition: all 300ms ease-in;
-o-transition: all 300ms ease-in;
transition: all 300ms ease-in;

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

Encountering an unsuccessful wp_remote_post during new user sign-up

While registering a user, I'm using the user_register hook to trigger a call to an external API. add_action( 'user_register', 'create_user_on_api' ); Within the create_user_on_api function, I make the call to the API using wp_rem ...

What steps do I need to follow to create a unique angular component that allows for customizable width using CSS styles?

The instructions on this website suggest that the width of the side-nav can be changed using CSS like so: md-sidenav { width: 200px; } This leads me to wonder, can I apply standard CSS properties such as width, position, etc... to custom components wi ...

How can I easily add both horizontal and vertical arrows to components in React?

Creating a horizontal line is as simple as using the following code: <hr style={{ width: "80%", border: "1px solid black" }} /> You can customize the width, length, and other properties as needed. If you want to display an arrow ...

Create an interactive table with dynamic content that prevents wrapping using the CSS property

I am trying to create a table with two columns and specific width. The left cell should display a single-line text with auto-ellipsis, while the right cell should have dynamic content that adjusts the width of the cell accordingly, shrinking the left cell& ...

Creating a clickable button within an image container using Bootstrap 5

I am attempting to create a button inside an img element, specifically in the center of that img element within Bootstrap 5. The image is not being used as a background on the grid and I am applying some hover animations to zoom in. I am curious if there ...

Slowly zooming background image

I've been searching all over the place but can't seem to find a clear answer on how to slowly zoom in the background image using CSS. Any help would be greatly appreciated. Currently, my code only zooms the text elements and not the background. ...

What is the best method to ensure a TALL table header is repeated on every page in Chrome?

First time poster =) I am currently facing an issue while trying to print a long table and have the table header repeat on each page. The problem arises when the height of the <thead> reaches a certain threshold, specifically 242px in Chrome 87.0.42 ...

Explore various SVG paths by hovering to reveal or conceal different divs

Hi there, I'll do my best to explain clearly. If this question has already been asked, I apologize as I couldn't find an answer when searching. I've used SVG to create a map on my HTML webpage and it's looking great. I also have hidden ...

Generating a table with two columns utilizing ng-repeat

I am currently dealing with an array of objects that I need to showcase in a two-column layout. The challenge arises because some columns have more data than others, requiring equi-height rows. Despite utilizing Bootstrap and clearfix in my attempts to di ...

Optimizing HTML Borders

I'm having trouble aligning the second border frame below the telephone image in a similar way to Gmail. I've tried multiple approaches but can't seem to get it right. Any assistance would be greatly appreciated :) .b1 { border: 1px s ...

Is there a way to properly center this text vertically within the row?

The kids are like puzzle pieces. I've experimented with different classes like justify-content-center, align-items-center, and text-center, but no luck. All I want is for the text to be perfectly centered both vertically and horizontally within the ...

The function .css() in jQuery is malfunctioning

This task should be a piece of cake... All I want is to hide the buttons when a user is logged in and display the log out button instead. jQuery().ready(function($) { if ($("body").hasClass("logged-in")) { $(".logged-out-button").css("display", " ...

Responsive left and right image styling in CSS and HTML

I have designed a landing page with fixed left and right images and content in the middle. It looks fine on desktop view, but on mobile view, the images are overlapping the content. How can I resolve this issue? <div class=" ...

Bootstrap 4's column ordering feature is malfunctioning

<div class="container"> <div class="row"> <div class="col-lg-8 col-md-12 order-2">1 </div> <div class="col-lg-4 col-md-12 order-1">2 </div> </div> </div> I need to change the orderi ...

Bootstrap card restricting ul tag from occupying full width

Utilizing Bootstrap in my WordPress site, I employed the bootstrap grid system to split the page contents into two sections, one of which includes a card acting as a navigation menu. However, the <ul> element is failing to expand to full width. Wit ...

Switching between light and dark mode in R Shiny tables with customizable headings

I'm currently working on a visualization project for tracking Covid-19 data, and I'm having trouble changing the text color above and below a table I've created. I've attached an image to show exactly what needs to be modified. Additio ...

What is the best way to center the 'email promo' text in the top navigation bar alongside the image and other text links?

Struggling with learning CSS and HTML, particularly when it comes to positioning elements on the page. I'm having trouble vertically aligning the elements inside the top nav bar and can't seem to figure out what I'm doing wrong. Any insights ...

Display of Navigation Bar in Angular is Not Proper

Currently diving into the world of Angular, I've encountered an issue with a material menu that isn't displaying correctly. The expected outcome based on my code should resemble this image: https://i.stack.imgur.com/z70Aq.png This snippet showc ...

When the jQuery Div is moved to the right, it gradually shrinks in size, yet remains unchanged when

I have been making updates to this page, which you can view here. When you select "Let's Get Started" and then proceed with the right arrows, the divs smoothly move to the left without shrinking. However, when clicking on the back or left arrows, the ...

Placing a pair of labels onto a bootstrap form while ensuring column alignment

I'm trying to format a form according to my UI/UX specifications, where there is a parent label and two sub-labels. Can this be achieved using Bootstrap? https://i.stack.imgur.com/J8wJZ.png However, I'm struggling to align the columns and rows ...