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:
<div id="container">
<div id="pack">
<img id="pack" src="http://imgur.com/uGMzOGM.png">
</div>
Javascript:
function FetchData() {
$("#pack").css('margin-left', 0);
$("#pack").css('margin-right', 0);
$("#pack").animate({
left: '-1000px'
}, 'slow');
});
}
setTimeout(FetchData, 7000);
CSS:
#pack {
margin: 5px auto;
position:fixed;
}
#container {
overflow:hidden;
}
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:By the way, you could do this purely with CSS using animations:
http://jsfiddle.net/UWLsB/192/
http://jsfiddle.net/UWLsB/191/
you can also make the first two lines of the function into one like this