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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:38:12+00:00 2026-05-27T10:38:12+00:00

Following function reveals <li> elements one by one from left to right. $.fn.fadeInEach =

  • 0

Following function reveals <li> elements one by one from left to right.

$.fn.fadeInEach = function(duration,callback){
    function fadeIn(i,elements,duration,callback){
        if(i >= elements.length)
            typeof callback == 'function' && callback();
        else
            elements.eq(i).fadeIn(duration,function(){
               fadeIn(i+1,elements,duration,callback);
            });        
    }
    fadeIn(0,this,duration,callback);
    return this;
} 

Executing like that

 $('.ftr-social-icons ul li').fadeInEach(200);

Lets say we have 9 <li> elements. What I want to get is, first reveal 5th element, then 4th and 6th, then 3th and 7th…

If there is 8 <li> elements, reveal at first 4th and 5th, and so on…

Any suggestions?

  • 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-27T10:38:12+00:00Added an answer on May 27, 2026 at 10:38 am

    Here’s a plugin example. Does this help?

    HTML:

    <h2>Colors</h2>
    <ol>
        <li>Red</li>
        <li>Orange</li>
        <li>Yellow</li>
        <li>Green</li>
        <li>Blue</li>
        <li>Indigo</li>
        <li>Violet</li>
    </ol>
    
        <h2>Directions</h2>
    <ol>
        <li>North</li>
        <li>East</li>
        <li>South</li>
        <li>West</li>
    </ol>
    

    JavaScript:

    $.fn.fadeInFromMiddle = function(duration, callback) {
        return this.each(function() {
            var radialFade = function($items, duration, indices) {
                setTimeout(function() {
                    var i, max, index;
    
                    for(i=0, max=indices.length; i<max; i++) {
                        index = indices[i]
                        $items.eq(index).animate({ 'opacity' : 1 });
                        indices[i] = i === 0 ? index - 1 : index + 1;
                    }
    
                    if(indices.length === 1) {
                        indices.push(indices[0]+2);
                    }
                    if(indices[0] >= 0) {
                        radialFade($items, duration, indices);
                    }
                    else if( typeof callback === "function" ) {
                        callback();
                    }
    
                }, duration);
            };
    
            // hide all
            var $items = $(this).children().css('opacity',0);
    
            // show from middle
            var size = $items.size(),
                indices = [ Math.ceil( size / 2)-1 ]; // starting point
            if( size % 2 === 0 ) { indices.push( indices[0]+1 ); }
            radialFade($items, duration, indices); // second param is delay between fades
    
        });
    };
    $(function() { 
        $('ol').fadeInFromMiddle(300);
    
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following function that is pulling data from a database. The ajax
So: I have the following function, adapted from a formula found online, which takes
The following function will pull down first X messages from Twitter firehose, but looks
The following function is set up to: Collect the user_id from my database, as
The following function works perfectly: protected void SendWebMailMessage(string DisplayName, string From, string ReplyTo, string
The following code reveals some of Chrome's internal call stack workings: (function revealCallStack() {
The following function: esb () { emacs -f server-start $@ &; } gives an
The following function System.Threading.Thread.Sleep(); delay the thread in millisecond, and take the integer value
/** The following function checks the red black tree black height * @param n
The following function generates a 'stack level too deep (SystemStackError)' for n = 5,000

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.