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/
[JavaScript] code
$(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:
- Text or picture
- Text or picture
- Text or picture
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