Skip to content Skip to sidebar Skip to footer

Javascript After 7 Seconds Slide Image

http://jsfiddle.net/UWLsB/189/ I am trying to make the image slide to the left after 7 seconds, how come it's not working? Html:

Solution 1:

You just have a syntax error. The }); line should be removed entirely:

http://jsfiddle.net/UWLsB/190/

I think you meant to use syntax that would have } and ) on the same line or got it from some tutorial like:

setTimeout(function () {
    // .animate call stuff here
}, 7000);

By the way, you could do this purely with CSS using animations:

http://jsfiddle.net/UWLsB/192/

Solution 2:

http://jsfiddle.net/UWLsB/191/

functionFetchData() {
    $("#pack").css('margin-left', 0);
    $("#pack").css('margin-right', 0);
    $("#pack").animate({
        left: '-1000px'
    }, 'slow');
}
setTimeout(FetchData, 7000);

you can also make the first two lines of the function into one like this

$("#pack").css({"margin-left": "0", "margin-right": "0"});

Post a Comment for "Javascript After 7 Seconds Slide Image"