Results 1 to 2 of 2

Thread: jQuery: wait for an animation to finish

  1. #1
    Join Date
    Oct 2010
    Posts
    2

    Post jQuery: wait for an animation to finish

    Hi !
    I'm still working on my gallery, and after a few hours of coding it's finally ready.
    Just a little bug I'd like to correct, but I don't know how !

    On psaikali.com, there's is a 'galeria' in the middle of the page. When the user clicks on the left/right arrow, it slides to show other artworks. So far, it's working.
    The only thing I'd like to fix is when you click twice (or more) on the arrow, the sliding effect will happen twice.

    But in my script, there are some conditionals existing to determine how long the sliding effect should be, depending on the number of artworks left to see. On a double click, these conditionals happen just once, so the expected result is destroyed

    I'd like to know if there is some kind of jQuery (or javascript) code to put in my onclick function to tell : 'wait before the animation is finished, then do what you have to do'.

    By the way, here is the line of my code doing the animation :
    Code:
    $("#galeria-slider").animate({ marginLeft:"+=1000px"}, 800 );
    I hope I'm clear enough ! If some developpers around there have a trick to avoid this, it would be great !

    Tchau.

    Pierre

  2. #2
    Join Date
    Oct 2010
    Posts
    3
    Hey pskl ,
    I'm not an expert on Jquery but I think this might be usefull for you .

    http://stackoverflow.com/questions/4...-the-other-one

    From what I understand Is that once the animation 1 is finished you would like to call something else . Aparently this can be acomplished using the callback function inside any jquery efect ,

    you can do something like this :

    $("#element1").slideUp(
    "slow",
    function(){
    $("#element2").slideDown("slow");
    }
    );


    the function inside the slideUp event is triggered once the animation is finished .

    I hope this is somehow helpfull to you ,
    cheers ,
    rodc

Similar Threads

  1. jquery co***ict problem (may be)
    By the_dinesh in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 28 Sep 2010, 01:23 AM
  2. CSS 3.0 animation features
    By jhonpeter in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 28 Jul 2010, 06:22 AM
  3. JQuery Slider + jQuery Popup = Problems
    By zibizibi in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 08 Aug 2009, 09:56 AM
  4. Fireworks button's text animation ???
    By j4mes_bond25 in forum Graphic Design
    Replies: 0
    Last Post: 18 May 2006, 04:58 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •