Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    348
    Thanks
    39
    Thanked 0 Times in 0 Posts

    JQuery image animation

    Ok, I was doing a simple JQuery animation. An image will move to the left by 1000px, once it stops, it will be replaced to another image. The code below:

    Code:
    function image1() {
        $('#photo').animate({left: '1000px'}, 40000, function() {
            $('#photo').attr('src', 'image2.jpg');
           setTimeout("image1", "2000")
        });
    }

    The issue, it does not work. How to tackle it?

    Thank!

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,677
    Thanks
    6
    Thanked 1,008 Times in 981 Posts
    Try removing the quotes around “image1” and around the timeout value in the setTimeout function.

  • #3
    Regular Coder
    Join Date
    Sep 2011
    Posts
    348
    Thanks
    39
    Thanked 0 Times in 0 Posts
    Sorry, but does not work

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,677
    Thanks
    6
    Thanked 1,008 Times in 981 Posts
    What does the error console say?

  • #5
    Regular Coder
    Join Date
    Sep 2011
    Posts
    348
    Thanks
    39
    Thanked 0 Times in 0 Posts
    No error at all... I dont know why it is not working..

  • #6
    Regular Coder
    Join Date
    Sep 2011
    Posts
    348
    Thanks
    39
    Thanked 0 Times in 0 Posts
    well the crap works now... but can you help me in another issue on this animation? thank


  •  

    Posting Permissions

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