<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>3-15</title>
<script type="text/javascript" src="http://s.59iwh.com/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="./lun.js"></script>
<style type="text/css">
.nav_nextad{ 283px;position:relative;text-align: center}
.nextad_photo{position: absolute;overflow: hidden;margin: 0}
.nextad_photo li{display: none;}
.nextad_photo li a img{ 243px}
.nextad_photo .showed{display: block}
.nav{ 283px;position:relative;text-align: center;margin-left: 300px}
.nextad{position: absolute;overflow: hidden;margin: 0}
.nextad li{display: none;}
.nextad li a img{ 243px}
.nextad .showed{display: block}
</style>
</head>
<body>
<div class="nav_nextad">
<ul class="nextad_photo">
<li class="showed"><a class="showed"><img src="http://img.59iwh.com/rc/bce2c54e8239cadfc724963c572139e6.jpg">
</a></li>
<li class=""><a class="showed" ><img src="http://img.59iwh.com/rc/1882be0b4ceecffaf44f46392aff503e.jpg">
</a></li>
</ul>
</div>
<div class="nav">
<ul class="nextad">
<li class="showed"><a class=" showed" ><img src="http://img.59iwh.com/rc/bce2c54e8239cadfc724963c572139e6.jpg">
</a></li>
<li class=""><a class=" showed"><img src="http://img.59iwh.com/rc/1882be0b4ceecffaf44f46392aff503e.jpg">
</a></li>
</ul>
</div>
</body>
<script type="text/javascript">
;(function($) {
$.fn.extend({
lun:function(t,time){
var len = $("."+t).find('li').length;
console.log(len);
var index = 0; //页序号
var adTimer;
$("."+t).mouseover(function() {
}).eq(0).mouseover();//滑入停止动画,滑出开始动画.
$('.'+t).hover(function() {
clearInterval(adTimer);
}, function() {
adTimer = setInterval(function() {
if (index == len) {
index = 0;
}
$("."+t).find('li').removeClass('showed').eq(index).addClass('showed');
index++;
}, time);
}).trigger("mouseleave");
}
});
})(jQuery);
$(function(){
var t = $(".nav_nextad").prop("className");
$(".nav_nextad").lun(t,5000);
var t = $(".nav").prop("className");
$(".nav").lun(t,2000);
})
</script>
</html>