简体   繁体   中英

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

You can animate background of DIV with jQuery.

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

Working JSFiddle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM