Home > Web Front-end > JS Tutorial > body text

jQuery loop scrolling display code can be applied to text and pictures_jquery

WBOY
Release: 2016-05-16 17:53:44
Original
917 people have browsed it

I saw some students using Adam Cai's code, which seemed a little complicated and not enough jQuery. I wrote a version based on the idea of ​​just getting started with jQuery. The code is less used and simpler.

Online demo: http://demo.jb51.net/js/2012/jquery_xhpic/
jQuery loop scrolling display code can be applied to text and pictures_jquery
[JavaScript] code

Copy code The code is as follows:

$(document).ready(function(){
$("# sItem li:not(:first)").css("display","none");
var B=$("#sItem li:last");
var C=$("#sItem li:first");
setInterval(function(){
if(B.is(":visible")){
C.fadeIn(500).addClass("in");B. hide()
}else{
$("#sItem li:visible").addClass("in");
$("#sItem li.in").next().fadeIn( 500);
$("li.in").hide().removeClass("in")}
},3000) //Switch one every 3 seconds, you can change it as needed
})

HTML part:
Copy code The code is as follows:


  • Text or picture

  • Text or picture

  • Text or picture


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!