I have a question concerning Javascript: I want to have the same effect of moving photos to the left/right 开发者_如何学编程like flickr on his page (please, compare the header on their page http://www.flickr.com, if you click on one of the dots under the picture).
If you can show me how to do it with pure JavaScript, CSS or the JavaScript framework jQuery it would be very helpful for me!
Thanks in advance, Jonas
With jQuery you can use the animate
function to animate a set of CSS properties. For example, to move an element 100 pixels to the left, taking 1000ms (1 second) to perform the animation:
$("#elementId").animate({
marginLeft: "-=100"
}, 1000, function() {
//Complete
}
);
See this fiddle for a working example.
精彩评论