HTML+JS简单轮播图
<div class="all-box">
<!---->
<div class="bg">
<div class="pic-box">
<div class="pic pic1"><img src="img/pic1.png" /></div>
<div class="pic pic2"><img src="img/pic2.png" /></div>
<div class="pic pic3"><img src="img/pic3.png" /></div>
</div>
</div>
</div>
</body>
<!---->
<script src="js/jquery-1.11.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var index = 0;
var time;
var num = 6000;
function fadein() {
index++;
if(index > 2) {
index = 0;
}
$('.pic-box .pic').eq(index).fadeIn('slow');
$('.pic-box .pic').eq(index).siblings().fadeOut('slow');
}
time = setInterval(fadein, 5000);
$('.all-box').mouseenter(function() {
clearInterval(time);
});
$('.all-box').mouseleave(function() {
time = setInterval(fadein, 5000);
});
});
</script>