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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:55:27+00:00 2026-05-18T03:55:27+00:00

am converting a flash animation to jquery# i basically have a load of divs

  • 0

am converting a flash animation to jquery#

i basically have a load of divs which are different colours, i want to the divs to fade in and out, each div has a different timing based on a fibonachi sequence,

i am having problems assigning a fade function to the div, i want the fade function to fade out the div then when is completed fade it in again, and keep repeating the process for each div.

here is my current code but it crashes firefox presumably to do with me having so many setintervals can anyone point me in the right direction please?

var myDiv ='#bannerHolder'
    var fib_str = '1, 2, 3, 5, 8, 13, 21, 1, 2, 3, 5, 8, 13, 21, 1, 2, 3, 5, 8, 13, 21, 1, 2, 3, 5, 8, 13'
    var widths_str = '33px, 31px, 35px, 9px, 16px, 50px, 33px, 24px, 40px, 20px, 63px, 30px, 10px, 29px, 11px, 12px, 51px, 31px, 35px, 11px, 14px, 50px, 30px, 25px, 38px, 20px, 35px'
    var pos_str = '0px, 44px, 105px, 144px, 153px, 203px, 236px, 269px, 280px, 354px, 374px, 437px, 447px, 457px, 506px, 517px, 529px, 604px, 646px, 687px, 698px, 712px, 762px, 787px, 823px, 895px, 915px'
    var color_str = '#D5E1D7, #18D4C9,#BF51C3,#1E82C9, #EDEDED, #E1C981, #C9A94F, #BDBCAA, #5DB522, #EB2F34, #823133, #004BD8, #A6A0A0, #DS9F36, #FFDB00, #69944F, #18D4C9, #BF51C3, #1E82C9, #6B949A, #FFDB00, #819E64, #BDBCAA, #54BA43, #EB2F34, #823133'
    var width = widths_str.split(",");
    var pos = pos_str.split(",");
    var color = color_str.split(",");
    var fib = fib_str.split(",");
    console.log(width);
    console.log(pos);
    console.log(color);
    var counter = width.length
    var stopper = false;
          for(i=0;i<counter;i++){
        var html = '<div id ="stripe'+i+'"/>'   
        $(myDiv).append(html)
        $('#stripe'+i).css({  'top': 0,  'left': pos[i],'position': 'absolute', 'float': 'left', 'background-color' : color[i]})
        $('#stripe'+i).attr({'height': 100, 'width': width[i], 'min-width' : width[i], 'min-height' : '100px'  })
        $('#stripe'+i).width(width[i])
        $('#stripe'+i).height('100px')
        var myfibtime = (fib[i] * 200);
        setInterval(stripeFadeOut(i), myfibtime );
                setInterval(stripeFadeIn(i), myfibtime );
    };
    function stripeFadeOut(id){
        $('#stripe'+id).fadeOut('slow');
        var myfibtime = (fib[id] * 200);
    }
    function stripeFadeIn(id){
        $('#stripe'+id).fadeIn('slow');
        var myfibtime = (fib[id] * 200);
    }

})

if i use setInterval('stripeFadeIn(' + id + ')', myfibtime+'; i get stripeFadeIn is undefined, if i try to use .animate as suguested by mathew i get too much recursion

  • 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-18T03:55:28+00:00Added an answer on May 18, 2026 at 3:55 am

    As you are creating interval object in your loop as well as in your setFadeIn function that causes creating interval objects exponentially. Ultimately ends up by crashing browser.

    Instead you can do one thing in the loop itself, create two intervals i.e one for fadeOut and one for fadeIn. Insted of ‘slow’, use some milliseconds of your choice.

    Then your fadeOut should be called on every myfibtime + animatingMilliseconds = fadeOutInterval. And your fadeIn should be called on every fadeOutInterval + animatingMilliseconds.

    I hope this will help you

    My suggestion completely refers to your old code. So do like this

    for(i=0;i<counter;i++){
            var html = '<div id ="stripe'+i+'"/>'   
            $(myDiv).append(html)
            $('#stripe'+i).css({  'top': 0,  'left': pos[i],'position': 'absolute', 'float': 'left', 'background-color' : color[i]})
            $('#stripe'+i).attr({'height': 100, 'width': width[i], 'min-width' : width[i], 'min-height' : '100px'  })
            $('#stripe'+i).width(width[i])
            $('#stripe'+i).height('100px')
            var myfibtime = (fib[i] * 200);
            var animTime = 1500;
            var fadeOutInterval = myfibtime + animTime;
            var fadeInInterval = fadeOutInterval  + animTime;
            setInterval(stripeFadeOut(i), fadeOutInterval );
            setInterval(stripeFadeIn(i), fadeInInterval );
        };
        function stripeFadeOut(id){
            $('#stripe'+id).fadeOut(1500);            
        }
        function stripeFadeIn(id){
            $('#stripe'+id).fadeIn(1500);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am converting a bells and whistles flash template into a HTML+CSS+JQuery template, mostly
I'm looking into converting a Flash application I have into JavaScript but was told
I have some older AS2-style Haxe code which uses flash.Lib.Current.CreateEmptyMovieClip() to create a slideshow
I have recently bought a template that came with a flash header. I want
I'm converting an application to use Java 1.5 and have found the following method:
I would like to make an animation using some tool (like e.g. Flash CS)
What library/API or even a program for converting flash code into html 5 code
I am converting a room editor I had made in AJAX to Flash where
Has anyone got experience in converting AS3 projects (no mxml) in Flex, to Flash
I believe the newest style of Flash-based advertisements might be a security risk. 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.