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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:55:26+00:00 2026-06-09T13:55:26+00:00

As this animation grows more complex, I keep adding in parameters, so that they

  • 0

As this animation grows more complex, I keep adding in parameters, so that they are available on each call back. 6 total currently.

For example now I want to disable the input box while the message is being displayed so I have to add in yet another element – in_element;

The Call:

    Mo.C.movePane( cover_element, pane_element, 0, 0, 0, 'begin' );

The Function:

    movePane: function( cover_element, pane_element, start, end, index, state ) {
        if( ( state === 'begin' ) ) {
            start = parseInt( window.getComputedStyle( pane_element, null ).getPropertyValue("top"), 10 );
            end = start + 40;
            index = start;
            state = 'down';
            cover_element.style.display = 'inline';
            Mo.C.movePane(cover_element, pane_element, start, end, index, 'down' );
        }
        if( ( state === 'down' ) && ( index < end ) ) {
            index += 1;
            pane_element.style.top = ( index ) + 'px';
            setTimeout( function( ){ Mo.C.movePane(cover_element, pane_element, start, end, index, state ); }, 1 );
        }
        else if( ( state === 'down' ) && index === end ) { 
            state = 'up';
            setTimeout( function( ){ Mo.C.movePane(cover_element, pane_element, start, end, index, state ); }, 2000 );
        }
        else if( ( state === 'up' ) && ( index > start ) ) {
            index -= 1;
            pane_element.style.top = ( index ) + 'px';
            setTimeout( function( ){ Mo.C.movePane(cover_element, pane_element, start, end, index, state ); }, 1 );
        }
        else if( ( state === 'up' ) && ( index === start ) ) {
            cover_element.style.display = 'none';
            // signup_pass_input.addEventListener( "keypress", Mo.UserNew.enter, false );
        }
    }
};

Possible Solutions

  • Wrap all in a single object called object_all = {}, and pass just this one variable.
  • Break up the functionality in some way – likely pull out the start and end conditions to separate functions
  • Move from function parameters to object properties ( statics ) to keep needed variables persistent
  • ?
  • 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-09T13:55:27+00:00Added an answer on June 9, 2026 at 1:55 pm

    It is normal to use an object when there are multiple parameters.
    Below you find an example of what the refactored code could look like:

    function( cover_element, pane_element, opt ) {
      var delay=1;
      if (!opt) {
        opt = {};
        opt.start =
          parseInt(
            window.getComputedStyle( pane_element, null ).
              getPropertyValue("top"),
            10
          );
        opt.end = opt.start + 40;
        opt.index = opt.start;
        opt.state = 'down';
        cover_element.style.display = 'inline';
      }
    
      switch(opt.state) {
        case 'down':
          opt.index += 1;
          if (opt.index >= opt.end) {
            opt.index = opt.end;
            opt.state = 'up';
            delay=2000;
          }
          break;
        case 'up':
          opt.index -= 1;
          if (opt.index <= opt.start) {
            cover_element.style.display = 'none';
            opt = null;
          }
      }
    
      if (opt) {
        pane_element.style.top = ( opt.index ) + 'px';
        setTimeout(
          function( ){
            Mo.C.movePane(cover_element, pane_element, opt);
          },
          delay
        );
      }
    }
    

    And call it like this:

    Mo.C.movePane(elem1, elem2);
    

    The delay when it switching directions is now 2000 instead of 2001.

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

Sidebar

Related Questions

I have this CSS3 animation that works in Chrome .circle-label-rotate { -webkit-animation-name: rotateThis; -webkit-animation-duration:.5s;
Is there any way to keep this simple JQuery animation from flashing? http://jsfiddle.net/v3DVf/6/
So, I have this animation that I want to run in the background of
I have an animation in my app that grows a UIImageView and then shrinks
I want when a user clicks a row, that row grows to show more
I want to create a dynamic HTML5 canvas animation. This animation should use server
I need this for some animation effects and i remember there is a window
How can I remove the animation from this jQuery modal window? You can see
I am wondering if there is a way to do this using Core Animation.
Why this delay of Jquery animation does not work as it should be? $(

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.