<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JQuery学习29_2篇(特效只是DOM操作+想像力)</title>
</head>
<style>
div {
width: 550px;
height: 550px;
overflow: hidden;
position: relative;
border: 3px solid red;
/*把边框做成圆角*/
/* border-radius: 100%; */
border-radius: 2%;
/* border-radius: 30%; */
border-radius: 10px;
}
img {
width: 550px;
height: 550px;
}
ul {
position: absolute;
bottom: 5px;
right:5px;
width: 200px;
height: 40px;
list-style:none;
}
li{
float: left;
width: 30px;
height: 30px;
text-align: center;
line-height: 30px;
background: white;
border-radius: 100%;
}
.active {
background: red;
}
</style>
<body>
<div id="ad">
<img src="img/a.jpg" alt="">
<img src="img/b.jpg" alt="">
<img src="img/c.jpg" alt="">
<ul>
<li class="active">1</li>
<li>2</li>
<li>3</li>
</ul>
</div>
</body>
<script src="jquery.js"></script>
<script>
/*
var i = 0;
setInterval(function (){
$('#ad img:first').hide(2000 , function(){
$(this).appendTo('#ad').show();
$('li').removeClass('active');
$('li').get(++i%3).className = 'active';
});
} , 4000);*/
/*
var i = 0;
setInterval(function (){
$('#ad img:first').fadeOut(1500 , function(){
$(this).appendTo('#ad').show();
$('li').removeClass('active');
$('li').get(++i%3).className = 'active';
});
} , 3000);
*/
var i = 0;
setInterval(function (){
$('#ad img:first').fadeOut(1500 , function(){
$(this).appendTo('#ad').show();
// alert('¥¥¥¥¥¥¥¥¥¥¥¥¥');
$('#ad img').hide();
// alert('**********');
$('#ad img:first').fadeIn(2000);
// alert('##########');
$('#ad img').show();
// alert('===========');
$('li').removeClass('active');
$('li').get(++i%3).className = 'active';
});
} , 5000);
</script>
</html>