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

  • Home
  • SEARCH
  • 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 7776203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:49:15+00:00 2026-06-01T17:49:15+00:00

(Hi guys) I am trying to create a scenario where <li> elements fade in

  • 0

(Hi guys) I am trying to create a scenario where <li> elements fade in and fade out one after another – which I can get to work.

I am also trying to stop the animation process when I hover over an <li> element that is currently being animated – which I can also get to work.

However I am having trouble being able to show an <li> element once it has been set to display:none, instead I have to wait for the animation to cycle through.

This is my current HTML markup;

<div id="content">
    <li class="one">one</li>
    <li class="two">two</li>
    <li class="three">three</li>
</div>

However I thought if I could nest the <li> elements within a which does not get hidden by my jQuery, then I could set the <li> element back to display:block when I mouse over the <div>.

Suggested markup;

<div id="content">
    <div class="wrap"><li class="one">one</li></div>
    <div class="wrap"><li class="two">two</li></div>
    <div class="wrap"><li class="three">three</li></div>
</div>

However with my jQuery pasted below you can see that it only treats the <li> elements if they are siblings of #content and not if they are nested.

jQuery(document).ready(function($) {
    $('#content li').hide();
    InOut($('#content li:first'));

    function InOut(elem) {
        elem.delay().fadeIn(1500).delay(5000).fadeOut(1500, function() {
            if (elem.next().length > 0) {
                InOut($(this).next());
            }
            else {
                InOut($(this).siblings(':first'));
            }

        });
    }

    $('#content li').mouseover(function() {
        $(this).fadeIn(500).stop(true, true);
    });
    $('#content li').mouseout(function() {
        if ($(this).is(":visible") == true) {
            InOut($(this));
        }
    });

});

For the sake of an example I have created a Fiddle of the current animation in sequence below;

http://jsfiddle.net/pusher/TuGES/1/

Any help is always appreciated.

Thank you!

  • 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-01T17:49:17+00:00Added an answer on June 1, 2026 at 5:49 pm

    To allow a mouseover on the hidden elements, you have to not use fadeOut() because that leaves the item as display: none which won’t receive mouse events. Instead, you need to leave it with an opacity of 0 which means you need to use fadeTo(). Here’s a fixed version of the code (with time intervals shortened for testing).

    I’ve fixed it so it has the following behavior:

    • When you mouseover an item that is fading out, it pops back to full visibility and all animation stops.
    • When you mouseover an item that is fading in, it pops to full visibility and all animation stops.
    • When you mouseover an item that was visible, it holds that item as visibility and no animation starts.
    • When you mouseout of an item, it starts the animation.
    • When you mouseover a hidden item, it shows that one immediately and hides all others.

    One of the keys to the fix was to stop all animation and .hide() all other elements (that may have been animating) because that’s the normal finished state of .fadeOut() which will allow the animation to start up again it’s normal way. After hiding all elements, we show the current one and set it’s opacity to 1 to get it in the fully visible state.

    jQuery(document).ready(function($) {
        $('#content li').css("opacity", 0);
        InOut($('#content li:first'));
    
        function InOut(elem) {
            elem.delay().fadeTo(1500, 1).delay(1000).fadeTo(1500, 0, function() {
                if (elem.next().length > 0) {
                    InOut($(this).next());
                }
                else {
                    InOut($(this).siblings(':first'));
                }
    
            });
        }
    
        $('#content li').mouseover(function() {
            $(this).siblings().add(this).stop(true, false).css("opacity", 0);
            $(this).show().css("opacity", 1);
        });
        $('#content li').mouseout(function() {
            if ($(this).is(":visible") == true) {
                InOut($(this));
            }
        });
    });​
    

    And, here’s a working demo: http://jsfiddle.net/jfriend00/k4ASz/

    P.S. I had to update your CSS a bit too because with all items in the page at all times, the layout is a bit different.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi guys i am trying to create one simple make file and execute in
Hey guys - I'm tearing my hair out trying to create a regular expression
Hey guys I'm trying to make a GUI which can navigate through JTextAreas when
Hey guys i'm trying to create a window which opens up when i click
What I'm trying to do Hello Guys, I'm trying to create a service which
What I try to do Hello Guys, I'm trying to create a Login-Screen which
Hey guys I'm trying to create a function and call it inside another each
What I'm trying to do Hello Guys, I'm trying to create a SplashScreen which
Hey guys Im currently trying to get a textbox a select menu and a
Hey guys i'm trying to convert url which looks like this example.com/sometype/author-name/sort-date or example.com/sometype/author-name/sort-date/something-value/

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.