Home  >  Article  >  Web Front-end  >  jQuery uses array to write pictures to seamlessly scroll left_jquery

jQuery uses array to write pictures to seamlessly scroll left_jquery

WBOY
WBOYOriginal
2016-05-16 17:46:55985browse

jQuery programming implements a set of 8 pictures. When entering the web page, the first 4 pictures are displayed initially, and then it automatically scrolls to the left until the screen stops scrolling when the last 4 pictures are displayed.
The following is the jQuery code:

Copy the code The code is as follows:

$(document) .ready(function() {
var $images = $('#images img');
var imgs = $images.length;
var next_img;
for(var i=0; inext_img=$images.eq(i);
scroll(next_img);
}
});
//Create a scrolling function, use animate function custom animation
function scroll(image) {
image.animate({'left':-485},5000);
};

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn