Learning
Learning

Reputation: 20001

Scroll Large horizontal image automatically

I have a simple HTML page with one div and one img tag,

<div class="wrapper">
    <img class="long-image" src="http://www.blueskyimages.info/images/header3.jpg?template=art_and_photography-003&colorScheme=blue&header=&button=buttons1" alt="this is long horizontal image"/>
</div>

Image is 4000x1000 pixels in dimension i want this image to auto scroll when image is loaded.

I am not sure how i can do this with just one Large image

Fiddle here

Upvotes: 0

Views: 1191

Answers (1)

freewheeler
freewheeler

Reputation: 1356

You can animate background of DIV with jQuery.

(function slide(){
    $('.wrapper').animate({backgroundPosition : '-=2px'}, 60, 'linear', slide);
})();

Working JSFiddle

Upvotes: 2

Related Questions