Difference between revisions of "Team:SSTi-SZGD/js/Team"

Line 63: Line 63:
 
var scrollLenth=$(".Content ul").position().left;
 
var scrollLenth=$(".Content ul").position().left;
 
$(".Content .Students  ul").stop().animate({"left":"0px"},500,function(){
 
$(".Content .Students  ul").stop().animate({"left":"0px"},500,function(){
$(".Content .Students  ul").prepend($(".Content .Students ul li:last"));
+
$(".Content .Students  ul").prepend($(".Content .Students ul li:last"));
 
$(".Content .Students  ul").css({"left":scrollLenth});
 
$(".Content .Students  ul").css({"left":scrollLenth});
 
});
 
});
Line 72: Line 72:
 
 
 
var scrollLenth=$(".Content ul").position().left;
 
var scrollLenth=$(".Content ul").position().left;
$(".Content .Students  ul").stop().animate({"left":scrollLenth*2},500,function(){
+
 
$(".Content .Students  ul").append($(".Content .Students ul li:first"));
+
if(scrollLenth=="-507"){
$(".Content .Students  ul").css({"left":scrollLenth});
+
$(".Content .Students  ul").stop().animate({"left":"-1014px"},500,function(){
});
+
$(".Content .Students  ul").append($(".Content .Students ul li:first"));
+
$(".Content .Students  ul").css({"left":scrollLenth});
console.log(scrollLenth);
+
});
 +
}
 +
else if(scrollLenth=="-450"){
 +
$(".Content .Students  ul").stop().animate({"left":"-900px"},500,function(){
 +
$(".Content .Students  ul").append($(".Content .Students ul li:first"));
 +
$(".Content .Students  ul").css({"left":scrollLenth});
 +
});
 +
}
 +
else{
 +
$(".Content .Students  ul").stop().animate({"left":"-1660px"},500,function(){
 +
$(".Content .Students  ul").append($(".Content .Students ul li:first"));
 +
$(".Content .Students  ul").css({"left":scrollLenth});
 +
});
 +
}
 +
 
 
}
 
}
  
Line 85: Line 99:
 
var scrollLenth=$(".Content ul").position().left;
 
var scrollLenth=$(".Content ul").position().left;
 
$(".Content .Teachers  ul").stop().animate({"left":"0px"},500,function(){
 
$(".Content .Teachers  ul").stop().animate({"left":"0px"},500,function(){
$(".Content .Teachers  ul").prepend($(".Content .Teachers ul li:last"));
+
$(".Content .Teachers  ul").prepend($(".Content .Teachers ul li:last"));
 
$(".Content .Teachers  ul").css({"left":scrollLenth});
 
$(".Content .Teachers  ul").css({"left":scrollLenth});
 
});
 
});
Line 94: Line 108:
 
 
 
var scrollLenth=$(".Content ul").position().left;
 
var scrollLenth=$(".Content ul").position().left;
$(".Content .Teachers  ul").stop().animate({"left":scrollLenth*2},500,function(){
+
 
$(".Content .Teachers  ul").append($(".Content .Teachers ul li:first"));
+
if(scrollLenth=="-507"){
$(".Content .Teachers  ul").css({"left":scrollLenth});
+
$(".Content .Teachers  ul").stop().animate({"left":"-1014px"},500,function(){
});
+
$(".Content .Teachers  ul").append($(".Content .Teachers ul li:first"));
 +
$(".Content .Teachers  ul").css({"left":scrollLenth});
 +
});
 +
}
 +
else if(scrollLenth=="-450"){
 +
$(".Content .Teachers  ul").stop().animate({"left":"-900px"},500,function(){
 +
$(".Content .Teachers  ul").append($(".Content .Teachers ul li:first"));
 +
$(".Content .Teachers  ul").css({"left":scrollLenth});
 +
});
 +
}
 +
else{
 +
$(".Content .Teachers  ul").stop().animate({"left":"-1660px"},500,function(){
 +
$(".Content .Teachers  ul").append($(".Content .Teachers ul li:first"));
 +
$(".Content .Teachers  ul").css({"left":scrollLenth});
 +
});
 +
}
 
 
 
}
 
}

Revision as of 12:11, 18 September 2017

/*自定义Team效果*/ $(function(){

$(".header .nav .mainnav").eq(1).hover(function(){ $(".header .nav .Team span").css("color","#FAEE0D"); },function(){ $(".header .nav .Team span").css("color","#FAEE0D"); });

});


/*轮播*/ $(function(){

//Students $(".Content .Students .scroll").hover(function(){

clearInterval(Students_Time);

},function(){

Students_Time=setInterval("Students_ScrollRight()",3000);

});

$(".Content .Students .icon_left").click(function(){ Students_ScrollLeft(); });

$(".Content .Students .icon_right").click(function(){ Students_ScrollRight(); });

//Teachers $(".Content .Teachers .scroll").hover(function(){

clearInterval(Teachers_Time);

},function(){

Teachers_Time=setInterval("Teachers_ScrollRight()",3000);

});

$(".Content .Teachers .icon_left").click(function(){ Teachers_ScrollLeft(); });

$(".Content .Teachers .icon_right").click(function(){ Teachers_ScrollRight(); });


});

var Students_Time=setInterval("Students_ScrollRight()",3000); var Teachers_Time=setInterval("Teachers_ScrollRight()",3000);

//Students function Students_ScrollLeft(){

var scrollLenth=$(".Content ul").position().left; $(".Content .Students ul").stop().animate({"left":"0px"},500,function(){ $(".Content .Students ul").prepend($(".Content .Students ul li:last")); $(".Content .Students ul").css({"left":scrollLenth}); });

}

function Students_ScrollRight(){

var scrollLenth=$(".Content ul").position().left;

if(scrollLenth=="-507"){ $(".Content .Students ul").stop().animate({"left":"-1014px"},500,function(){ $(".Content .Students ul").append($(".Content .Students ul li:first")); $(".Content .Students ul").css({"left":scrollLenth}); }); } else if(scrollLenth=="-450"){ $(".Content .Students ul").stop().animate({"left":"-900px"},500,function(){ $(".Content .Students ul").append($(".Content .Students ul li:first")); $(".Content .Students ul").css({"left":scrollLenth}); }); } else{ $(".Content .Students ul").stop().animate({"left":"-1660px"},500,function(){ $(".Content .Students ul").append($(".Content .Students ul li:first")); $(".Content .Students ul").css({"left":scrollLenth}); }); }

}

//Teachers function Teachers_ScrollLeft(){

var scrollLenth=$(".Content ul").position().left; $(".Content .Teachers ul").stop().animate({"left":"0px"},500,function(){ $(".Content .Teachers ul").prepend($(".Content .Teachers ul li:last")); $(".Content .Teachers ul").css({"left":scrollLenth}); });

}

function Teachers_ScrollRight(){

var scrollLenth=$(".Content ul").position().left;

if(scrollLenth=="-507"){ $(".Content .Teachers ul").stop().animate({"left":"-1014px"},500,function(){ $(".Content .Teachers ul").append($(".Content .Teachers ul li:first")); $(".Content .Teachers ul").css({"left":scrollLenth}); }); } else if(scrollLenth=="-450"){ $(".Content .Teachers ul").stop().animate({"left":"-900px"},500,function(){ $(".Content .Teachers ul").append($(".Content .Teachers ul li:first")); $(".Content .Teachers ul").css({"left":scrollLenth}); }); } else{ $(".Content .Teachers ul").stop().animate({"left":"-1660px"},500,function(){ $(".Content .Teachers ul").append($(".Content .Teachers ul li:first")); $(".Content .Teachers ul").css({"left":scrollLenth}); }); }

}