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

Line 14: Line 14:
 
$(function(){
 
$(function(){
 
 
//public
 
var scrollLenth=$(".Content ul").outerWidth();
 
$(".Content ul").css("left",-scrollLenth*0.11);
 
 
 
//Students
 
//Students
 
$(".Content .Students .scroll").hover(function(){
 
$(".Content .Students .scroll").hover(function(){
Line 54: Line 50:
 
$(".Content .Teachers .icon_right").click(function(){
 
$(".Content .Teachers .icon_right").click(function(){
 
Teachers_ScrollRight();
 
Teachers_ScrollRight();
});
+
});
 +
 
 
 
});
 
});
Line 63: Line 60:
 
//Students
 
//Students
 
function Students_ScrollLeft(){
 
function Students_ScrollLeft(){
+
var scrollLenth=$(".Content .Students ul").outerWidth();
+
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*0.11});
+
$(".Content .Students  ul").css({"left":scrollLenth});
 
});
 
});
 
 
Line 74: Line 71:
 
function Students_ScrollRight(){
 
function Students_ScrollRight(){
 
 
var scrollLenth=$(".Content .Students  ul").outerWidth();
+
var scrollLenth=$(".Content ul").position().left;
$(".Content .Students  ul").stop().animate({"left":-scrollLenth*0.11*2},500,function(){
+
$(".Content .Students  ul").stop().animate({"left":scrollLenth*2},500,function(){
 
$(".Content .Students  ul").append($(".Content .Students  ul li:first"));
 
$(".Content .Students  ul").append($(".Content .Students  ul li:first"));
$(".Content .Students  ul").css({"left":-scrollLenth*0.11});
+
$(".Content .Students  ul").css({"left":scrollLenth});
 
});
 
});
 
 
 +
console.log(scrollLenth);
 
}
 
}
  
 
//Teachers
 
//Teachers
 
function Teachers_ScrollLeft(){
 
function Teachers_ScrollLeft(){
+
var scrollLenth=$(".Content .Teachers ul").outerWidth();
+
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*0.11});
+
$(".Content .Teachers  ul").css({"left":scrollLenth});
 
});
 
});
 
 
Line 95: Line 93:
 
function Teachers_ScrollRight(){
 
function Teachers_ScrollRight(){
 
 
var scrollLenth=$(".Content .Teachers  ul").outerWidth();
+
var scrollLenth=$(".Content ul").position().left;
$(".Content .Teachers  ul").stop().animate({"left":-scrollLenth*0.11*2},500,function(){
+
$(".Content .Teachers  ul").stop().animate({"left":scrollLenth*2},500,function(){
 
$(".Content .Teachers  ul").append($(".Content .Teachers  ul li:first"));
 
$(".Content .Teachers  ul").append($(".Content .Teachers  ul li:first"));
$(".Content .Teachers  ul").css({"left":-scrollLenth*0.11});
+
$(".Content .Teachers  ul").css({"left":scrollLenth});
 
});
 
});
 
 
 
}
 
}

Revision as of 03:02, 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; $(".Content .Students ul").stop().animate({"left":scrollLenth*2},500,function(){ $(".Content .Students ul").append($(".Content .Students ul li:first")); $(".Content .Students ul").css({"left":scrollLenth}); });

console.log(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; $(".Content .Teachers ul").stop().animate({"left":scrollLenth*2},500,function(){ $(".Content .Teachers ul").append($(".Content .Teachers ul li:first")); $(".Content .Teachers ul").css({"left":scrollLenth}); });

}