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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:52:47+00:00 2026-05-25T19:52:47+00:00

Im building a custom timed image slider for a site, and im stuck on

  • 0

Im building a custom timed image slider for a site, and im stuck on a basic principle. I have a recursive function that starts on the pageload. Im wondering how to immediatly stop the function and then restart it at the beginning with an onclick.

In the follwing jsfiddle example, can someone please tell me how i make the red square start at margin 0 and then start the bounce() function again, when the ‘blue’ or ‘green’ button is clicked?

for example:
if the red square is towards the right, when ‘blue’ is clicked, how can i make the square appear at ‘margin-left:0’ and then have the bounce() function start again?

Thanks so much. http://jsfiddle.net/hZ6xZ/7/

  • 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-25T19:52:48+00:00Added an answer on May 25, 2026 at 7:52 pm

    Fiddle – http://jsfiddle.net/mrtsherman/hZ6xZ/9/

    Use jQuery’s stop() to kill the current animation. Also take a look into method chaining which is more efficient than calling $(‘#box’) a lot of times.

    $('#blue').click(function(){
        repeat = clearTimeout(repeat);
        $('.box')
            .stop()
            .css({'background-color':'blue'})
            .css({'margin-left':'0'});
    
        bounce();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wrestling with building a custom membership provider that allows me to have the
For an app I'm building, I have a custom old map effect PNG that
I'm building an ASP.NET MVC applicaiton that will have custom role and membership providers.
I'm building a custom Ubuntu kernel and have modified one of the source files.
I'm building a custom RTE that converts user input to a homebrewn markup, now
I’m building a custom robotish machine that has 8 switches I need to interface
I'm currently building an air app with FB 4. I have a custom control
I'm building a Rails app that needs to connect to a custom TCP data
I'm building a web site for an artist who has had a custom font
I am building my project with Apache Maven and have a custom repository configured

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.