简体   繁体   English

自动滚动大水平图像

[英]Scroll Large horizontal image automatically

I have a simple HTML page with one div and one img tag, 我有一个简单的HTML页面,其中包含一个div和一个img标签,

<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. 图片的尺寸为4000x1000像素,我希望此图片在加载图片时自动滚动。

I am not sure how i can do this with just one Large image 我不确定我如何仅用一张就能做到这一点

Fiddle here 在这里摆弄

You can animate background of DIV with jQuery. 您可以使用jQuery为DIV的背景设置动画。

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

Working JSFiddle 工作中的JSFiddle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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