Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

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!
Posted
Comments
Samsani.v.s.Durga Prasad 30-Oct-12 2:10am    
Hi here the problem is your "image2.jpg" location

Give the proper image path where it is

1 solution

Hi i tried this working properly


$(document).ready(function () {

           $("img").animate({ "margin-left": "200px" }, 5000, function () {

               $("img").attr("src" , "../Images/ajaxload1.gif");

           });

       });
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900