You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.0 KiB
80 lines
2.0 KiB
6 years ago
|
$(function(){
|
||
|
var i=0;
|
||
|
var clone=$(".banner .img li").first().clone();
|
||
|
$(".banner .img").append(clone);
|
||
|
var size = $(".banner .img li").size();
|
||
|
$(".banner .img").width((size*1200)+"px");
|
||
|
for(var j=0;j<size-1;j++){
|
||
|
$(".banner .num").append("<li></li>");
|
||
|
}
|
||
|
$(".banner .num li").first().addClass('on');
|
||
|
//鼠标划入圆点
|
||
|
$(".banner .num li").hover(function(){
|
||
|
var index=$(this).index();
|
||
|
i=index;
|
||
|
$(".banner .img").stop().animate({left:-index*1200},1000);
|
||
|
$(this).addClass('on').siblings().removeClass('on');
|
||
|
})
|
||
|
|
||
|
/*自动轮播*/
|
||
|
var t=setInterval(function(){
|
||
|
i++;
|
||
|
move();
|
||
|
},6000);
|
||
|
|
||
|
//对banner定时器的操作
|
||
|
|
||
|
|
||
|
$("#index-top").hover(function(){
|
||
|
clearInterval(t);
|
||
|
$(".banner-l,.banner-r").show();
|
||
|
},function(){
|
||
|
$(".banner-l,.banner-r").hide();
|
||
|
t=setInterval(function(){
|
||
|
i++;
|
||
|
move();
|
||
|
},6000);
|
||
|
})
|
||
|
|
||
|
|
||
|
/*向左按钮*/
|
||
|
$(".banner-l").click(function(){
|
||
|
i--;
|
||
|
move();
|
||
|
})
|
||
|
/*向右按钮*/
|
||
|
$(".banner-r").click(function(){
|
||
|
i++;
|
||
|
move();
|
||
|
})
|
||
|
|
||
|
function move(){
|
||
|
if(i==size){
|
||
|
$(".banner .img").css({left:0});
|
||
|
i=1;
|
||
|
}
|
||
|
if(i==-1){
|
||
|
$(".banner .img").css({left:-(size-1)*1200});
|
||
|
i=size-2;
|
||
|
}
|
||
|
|
||
|
$(".banner .img").stop().animate({left:-i*1200},1000);
|
||
|
|
||
|
if(i==size-1){
|
||
|
$(".banner .num li").eq(0).addClass('on').siblings().removeClass('on');
|
||
|
}else{
|
||
|
$(".banner .num li").eq(i).addClass('on').siblings().removeClass('on');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
// 首页实训导航栏点击事件
|
||
|
$(".welcome_shixun_index").bind("click", function(e){
|
||
|
var id = $(this).attr("data-id");
|
||
|
var type = $(this).attr("data-type");
|
||
|
window.location.href="/shixuns?id=" + id + "&type=" + type;
|
||
|
|
||
|
e.stopPropagation();
|
||
|
})
|
||
|
})
|