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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:44:49+00:00 2026-05-16T14:44:49+00:00

Trying to solve that problem, but no luck for hours… I have var screen1

  • 0

Trying to solve that problem, but no luck for hours…

I have

var screen1 = $('#screen');
var screen2 = $('#screen_teams');
var screen3 = $('#field_position');
. . .

screenFade(screen1,1000,1);
function screenFade(screen,delay,next) {
    if (next == 1) {
        screen.delay(delay).fadeOut(1000, function() {animation(2);console.log('2');});
    } else {
        screen.fadeIn(1000).delay(delay).fadeOut(1000, function() {animation(next);console.log(next);});
    }
}
function animation(seq) {
    if (seq == 2) {
        screenFade(screen2,2000,3);
    };
    if (seq == 3) {
        screenFade(screen3,2000,4);
    };
    if (seq == 4) {
        screenFade(screen4,2000,5);
    };
}

And firebug outputs:
2
2
3
3
4
4
5
5

Do you know the solution? Thanks in advance!

  • 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-16T14:44:50+00:00Added an answer on May 16, 2026 at 2:44 pm

    I think your biggest issue is the recursive nature of your code… I think a little simplification is in order.

    If you put all of your “screens” as child elements of a parent then you can easily use a rotate plugin I wrote for jQuery:

    If the parent element had an ID of screens and each screen was a child div then you could use the plugin like this:

    function() rotateCallback(screenNumber, screen) {
        if(screenNumber == 4)
            callOtherFunction();
    }
    
    $(function() {
        $("#screens div").Rotate({ cycleTime: 2000, fadeTime: 1000, callback: rotateCallback});
    })
    

    On the window load event this will select all of the child divs of the parent with an ID of screens and then rotate every 2 seconds fading over 1 second.

    Here’s the plugin code:

    jQuery.fn.Rotate = function(config) {
        var currentIdx = 0;
        var items = [];
        var itemCount = this.each(function(idx, item) {
            items.push($(item));
        }).length;
    
        function rotateItem()
        {
            var front = items[currentIdx];
            var back = items[currentIdx = ((currentIdx + 1) % itemCount)];
    
            back.fadeIn(config.fadeTime);
            front.fadeOut(config.fadeTime, function() { front.hide() });
    
            if(config.callback)
                config.callback(currentIdx, back);
        }
        setInterval(rotateItem, config.cycleTime);
    }
    

    –Update–

    Added callback on rotation and example.

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

Sidebar

Related Questions

I'm trying to solve the 3n+1 problem and I have a for loop that
In trying to solve the ajax back button problem I have found the Really
I have a problem I'm trying to solve involving interfaceing a C++ program with
I'm having a problem, I've been trying to solve it since yesterday but no
I'm facing a problem that Google couldn't solve yet! I'm trying to store URLs
I've got a rather tricky problem that I've been trying to solve for the
I'm trying to solve a problem (in php, but programming language doesn't matter). I'm
For few days now I'm trying to solve this problem. I have table group_user,
I am trying to solve a problem that involves basically implementing a logical AND
I was trying to solve my XNA Font problem , when I found this

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.