SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: loop animation

  1. #1
    SitePoint Addict mari's Avatar
    Join Date
    Nov 2007
    Location
    London, UK
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question loop animation

    Hi

    I have a bit of text that i want to increase the size of, here is the code im using

    Code:
    <script>
      $(document).ready(function(){
        
        // Using multiple unit types within one animation.
        $("#text").init(function(){
          $("#text").animate({ 
            fontSize: "24px", 
          }, 1500
    	   );
    
        });
    
      });
      </script>
    this works when i load the page i see the text increasing, what i would like to do is make it go back to the original size and then keep looping from original size to the animate at certain intervals

    basically i want it to loop lol

    how do i do this?
    help is appreciated

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,712
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    The animate method has a callback function, so that you when it finishes performing one effect you can then call a separate function to perform another effect.
    http://docs.jquery.com/Effects/animate

    That way you can perform an effect, and then restore it back to its former glory.

    Then, you can use setInterval to call the main function that performs that effect on a timed basis.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

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