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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:35:44+00:00 2026-05-23T23:35:44+00:00

I have a JavaScript script that will hopefully have multiple divs fade in/out every

  • 0

I have a JavaScript script that will hopefully have multiple divs fade in/out every couple of seconds. Only one will be visible at once. I’ve created the following to do the job:

var tmnlSpDelay = 5000;
var $currentVis = null;

tmnlFadeIn = function ($re) {
    $re.css("display", "inline");
    $re.fadeIn('slow', "");
    $currentVis = $re;
    setTimeout("tmnlSpinner();", tmnlSpDelay);
}

tmnlSpinner = function () {
    var $random_elem = $('.topcontent').eq(Math.floor(Math.random() * $('.topcontent').length));
    if ($currentVis != null) {
        $currentVis.fadeOut('slow', "function() { tmnlFadeIn($random_elem) }");
    } else {
        tmnlFadeIn($random_elem);
    }
}

$(document).ready(function () {
    tmnlSpinner();
});

As you can see, I’m utilizing jQuery as well to help me. The problem is after it has ran once and runs tmnlSpinner again (except, because it has already run once, currentVis is no longer null). When it runs the fadeOut on $currentVis, it just stops working. Google Chrome isn’t giving me any feedback on any kind of error. Does anybody see any issues?

  • 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-23T23:35:45+00:00Added an answer on May 23, 2026 at 11:35 pm

    Remove the quotes around "function() { tmnlFadeIn($random_elem) }". You’re passing a string where you should pass a callback.

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

Sidebar

Related Questions

I have a script that will change font sizes for particular divs. I have
I have a php script that uses some css/javascript tabs, they work on my
i have a dialog box that opens on pageload for a site. script type=text/javascript>
I have this simple code that speaks for itself. <script language='javascript"> function check() {}
I have to maintain a server-side script written in JScript (NOT Javascript) that needs
I currently have an ASP Classic script that runs every 15 minutes (via scheduled
i have this script below that will resize the .content on window resize it
I have a JS script that will be hosted on my server and that
I have an external JavaScript file that will be used on pages with lots
I have a PHP script that will run for a long time. I have

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.