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 7442177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:08:09+00:00 2026-05-29T11:08:09+00:00

I have some elements that, upon hover, toggle the display (none/block) of a child

  • 0

I have some elements that, upon hover, toggle the display (none/block) of a child ul. Unfortunately, I can’t transition a fade via CSS with display. Using opacity won’t work either since the hover area expands onto the opacity: 0 ul, and a combo of both (transition opacity, but still toggle display) doesn’t seem to work.

Is there a way to intercept the display change via Javascript, and have it fade between block and none? Are there alternate suggestions (I tried a height: 0/auto toggle too, didn’t work right)? I’d prefer an intercept method than a pure JS method, in case JS is disabled or something.

  • 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-05-29T11:08:09+00:00Added an answer on May 29, 2026 at 11:08 am

    If I understand you correctly. Assuming something like: <div class="nav-container"><ul></ul></div>.

    You can listen for hover on the parent, since it contains the child:

    var parent      = document.getElementsByClassName('nav-container')[0];
    var connect     = function (element, event, callback) {/* I think you */};
    var disconnect  = function (handle) {                  /* can find */};
    var addClass = function (element, className) {      /* these elsewhere. */};
    var removeClass = function (element, className) {      /* ... */};
    var hoverHandle = connect(parent, 'hover', function (event) {
        addClass(parent, 'hovered');
        if (blurHandle) {
            disconnect(blurHandle);
        }
    });
    var blurHandle = = connect(parent, 'blur', function (event) {
        removeClass(parent, 'hovered');
        if (hoverHandle) {
            disconnect(hoverHandle);
        }
    });  
    

    Then in the CSS:

    .nav-container > ul {
        display: none;
        /* do fade out */
    } 
    .nav-container.hovered > ul {
        display: block;
        /* do fade in */
    }
    

    If you’re using jQuery 1.7, then this’ll become:

    var navContainers = $('.nav-container');
    navContainers.on('hover', function () {
         $(this).toggleClass('hovered');
    });
    navContainers.on('blur', function () {
        $(this).toggleClass('hovered');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a 100 classes that have some similar elements and some unique. I've
I have created some functional categories that I use to show/hide markup elements. However,
I have a setup function that runs onload to add some behaviours to elements.
i have several common elements (components), that will generate some html. it seems my
I have a <div> that opens up on a jquery hover event (display goes
I have some AJAX work that brings across an additional form element that I
I have some elements on a page which are draggable. These same elements have
I have some elements with (.) periods in them and I need to select
I have some elements with events bound. Before I remove those elements, do I
I have some elements and I'm using some jQuery plugins. I want to see

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.