轮播图

```

1.

$(function () {

var index = 0;

var timer = null;

$('.continer').mouseover(function () {

$('.control').css('display','block');

clearInterval(timer);

}).mouseout(function () {

$('.control').css('display','none');

timer = setInterval(scroll,1000);

});

timer = setInterval(scroll,1000);

function scroll() {

index++;

if(index>4) {

index = 0;

}

scrollImgAndRound(index);

}

$('.round>li').mouseover(function () {

scrollImgAndRound($(this).index());

index = $(this).index();

});

$('#controlLeft').click(function () {

index--;

if (index<0){

index = 4;

}

scrollImgAndRound(index);

});

$('#controlRight').click(function () {

index++;

if(index>4){

index = 0;

}

scrollImgAndRound(index);

});

function scrollImgAndRound(index) {

$('.scrollImage>li').eq(index).css('display','block').siblings().css('display','none');

$('.round>li').eq(index).css('background','#222').siblings().css('background','#878787');

}

});

2,

$(function(){

$('.visualCon>ol>li').each(function(i,ele){

$(ele).click(function(){

$(ele).show().css('background-color','#000').siblings().css('background-color','#ccc');

$('.visualCon>ul>li').eq($(this).index()).show().stop().animate({'left':0},300);

$('.visualCon>ul>li').eq($(this).index()).prevAll().each(function(i,ele){

$(ele).stop().animate({'left':'-'+(i+1)*100+'%'},300);

});

$('.visualCon>ul>li').eq($(this).index()).nextAll().each(function(i,ele){

$(ele).stop().animate({'left':(i+1)*100+'%'},300);

});

});

});

});

```

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容