/* 代码整理:懒人之家 www.lanrenzhijia.com */
$(function(){
var numpic = $('#slides li').size()-1;
var nownow = 0;
var inout = 0;
var tt = 0;
var speed = 5000;
$('#slides li').eq(0).siblings('li').css({'display':'none'});
var ulstart = '
';
addli();
var pagination = $('#pagination li');
var paginationwidth = $('#pagination').width();
$('#pagination').css('margin-left',(470-paginationwidth))
pagination.eq(0).addclass('current')
function addli(){
//var lilicount = numpic + 1;
for(var i = 0; i <= numpic; i++){
ulcontent += '' + '' + (i+1) + '' + '';
}
$('#slides').after(ulstart + ulcontent + ulend);
}
pagination.on('click',dotchange)
function dotchange(){
var changenow = $(this).index();
$('#slides li').eq(nownow).css('z-index','900');
$('#slides li').eq(changenow).css({'z-index':'800'}).show();
pagination.eq(changenow).addclass('current').siblings('li').removeclass('current');
$('#slides li').eq(nownow).fadeout(400,function(){$('#slides li').eq(changenow).fadein(500);});
nownow = changenow;
}
pagination.mouseenter(function(){
inout = 1;
})
pagination.mouseleave(function(){
inout = 0;
})
function gogo(){
var nn = nownow+1;
if( inout == 1 ){
} else {
if(nownow < numpic){
$('#slides li').eq(nownow).css('z-index','900');
$('#slides li').eq(nn).css({'z-index':'800'}).show();
pagination.eq(nn).addclass('current').siblings('li').removeclass('current');
$('#slides li').eq(nownow).fadeout(400,function(){$('#slides li').eq(nn).fadein(500);});
nownow += 1;
}else{
nn = 0;
$('#slides li').eq(nownow).css('z-index','900');
$('#slides li').eq(nn).stop(true,true).css({'z-index':'800'}).show();
$('#slides li').eq(nownow).fadeout(400,function(){$('#slides li').eq(0).fadein(500);});
pagination.eq(nn).addclass('current').siblings('li').removeclass('current');
nownow=0;
}
}
tt = settimeout(gogo, speed);
}
tt = settimeout(gogo, speed);
})
/* 代码整理:懒人之家 www.lanrenzhijia.com */