Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8389679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:47:37+00:00 2026-06-09T18:47:37+00:00

I am trying to animate an element when the cursor enters its parent element

  • 0

I am trying to animate an element when the cursor enters its parent element and reverse that animation reliably when the mouse exits the element – for multiple levels of nested elements. I can do it clunkily with CSS (transitions not an option) but want to use jQuery to sexy it up 😉

An example of what I’m trying to achieve is this type of accordion menu but, as I say, with jQuery.

So far I have tried using mouseenter and mouseleave for the same example but can’t seem to get it to work after the first expand and contract.

How can I reliably and elegantly bind this hide/show animation to a mouseenter/mouseleave or something similar in jQuery?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:47:39+00:00Added an answer on June 9, 2026 at 6:47 pm

    It seems work

    http://jsfiddle.net/sechou/Rce8A/2/

    $(function(){
      //bind event
      $("li.level1").mouseenter(   
        function(){
           // make sure the item would diplay
           $(this).find("ul:first").find("li.level2").show(); 
           // do "show" 
           $(this).find("ul:first").show(500);       
        });
    
      $("li.level1").mouseleave(
          function() {
            // do "hide" 
            $(this).find(":parent").hide(500);
          }
      );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get an element to animate to its natural height - i.e.
I have trying to achieve SVG element's animation while adding dynamic DOMs for its
I am trying to animate an element that is absolutely positioned and positioned bottom
I'm trying to animate a logo when you hover over the anchor element. When
I'm trying to find the class .post-info inside the parent of a clicked element,
I am trying to animate an element without jquery making it display:none is there
Why does onmouseover run multiple times while I hover over one element? I'm trying
I am trying to animate the background of an element from it's current position
I'm trying to make it so that when a li element is hovered the
I'm currently trying to use Quicksand, a jquery plugin that allows you to animate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.