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

Line 3: Line 3:
 
var winHeight=$(window).height();
 
var winHeight=$(window).height();
 
if(winHeight>=380){
 
if(winHeight>=380){
 +
$(".SSTi-SZGD").css("height",winHeight);
 +
$(".topic").css("top",winHeight*0.35);
 +
}
 +
else{
 +
winHeight=380;
 
$(".SSTi-SZGD").css("height",winHeight);
 
$(".SSTi-SZGD").css("height",winHeight);
 
$(".topic").css("top",winHeight*0.35);
 
$(".topic").css("top",winHeight*0.35);
 
}
 
}
 
$(window).resize(function(){
 
$(window).resize(function(){
winHeight = $(window).height();
+
winHeight=$(window).height();
 
if(winHeight>=380){
 
if(winHeight>=380){
 
$(".SSTi-SZGD").css("height",winHeight);
 
$(".SSTi-SZGD").css("height",winHeight);
 
$(".topic").css("top",winHeight*0.35);
 
$(".topic").css("top",winHeight*0.35);
 +
}else{
 +
winHeight=380;
 +
$(".SSTi-SZGD").css("height",winHeight);
 +
$(".topic").css("top",winHeight*0.35);
 +
}
 +
});
 +
});
 +
 +
/*延时加载*/
 +
$(function(){
 +
var winHeight=$(window).height();
 +
var Project_IntroductionTop=$(".Project_Introduction_box").offset().top-$(window).scrollTop();
 +
var footerTop=$(".footer_box").offset().top-$(window).scrollTop();
 +
if(Project_IntroductionTop<winHeight-100){
 +
setTimeout(function(){
 +
$(".Project_Introduction").addClass("a-bouncein");
 +
$(".Project_Introduction").css("display","block");
 +
},150);
 +
}
 +
if(footerTop<winHeight-100){
 +
setTimeout(function(){
 +
$(".footer").addClass("a-fadein");
 +
$(".footer").css("display","block");
 +
},150);
 +
}
 +
$(window).scroll(function(){
 +
winHeight=$(window).height();
 +
Project_IntroductionTop=$(".Project_Introduction_box").offset().top-$(window).scrollTop();
 +
footerTop=$(".footer_box").offset().top-$(window).scrollTop();
 +
if(Project_IntroductionTop<winHeight-100){
 +
setTimeout(function(){
 +
$(".Project_Introduction").addClass("a-bouncein");
 +
$(".Project_Introduction").css("display","block");
 +
},150);
 
}
 
}
 +
if(footerTop<winHeight-100){
 +
setTimeout(function(){
 +
$(".footer").addClass("a-fadein");
 +
$(".footer").css("display","block");
 +
},150);
 +
}
 
});
 
});
 
});
 
});

Revision as of 07:13, 26 July 2017

/*跟随窗口大小的高度*/ $(function(){ var winHeight=$(window).height(); if(winHeight>=380){ $(".SSTi-SZGD").css("height",winHeight); $(".topic").css("top",winHeight*0.35); } else{ winHeight=380; $(".SSTi-SZGD").css("height",winHeight); $(".topic").css("top",winHeight*0.35); } $(window).resize(function(){ winHeight=$(window).height(); if(winHeight>=380){ $(".SSTi-SZGD").css("height",winHeight); $(".topic").css("top",winHeight*0.35); }else{ winHeight=380; $(".SSTi-SZGD").css("height",winHeight); $(".topic").css("top",winHeight*0.35); } }); });

/*延时加载*/ $(function(){ var winHeight=$(window).height(); var Project_IntroductionTop=$(".Project_Introduction_box").offset().top-$(window).scrollTop(); var footerTop=$(".footer_box").offset().top-$(window).scrollTop(); if(Project_IntroductionTop<winHeight-100){ setTimeout(function(){ $(".Project_Introduction").addClass("a-bouncein"); $(".Project_Introduction").css("display","block"); },150); } if(footerTop<winHeight-100){ setTimeout(function(){ $(".footer").addClass("a-fadein"); $(".footer").css("display","block"); },150); } $(window).scroll(function(){ winHeight=$(window).height(); Project_IntroductionTop=$(".Project_Introduction_box").offset().top-$(window).scrollTop(); footerTop=$(".footer_box").offset().top-$(window).scrollTop(); if(Project_IntroductionTop<winHeight-100){ setTimeout(function(){ $(".Project_Introduction").addClass("a-bouncein"); $(".Project_Introduction").css("display","block"); },150); } if(footerTop<winHeight-100){ setTimeout(function(){ $(".footer").addClass("a-fadein"); $(".footer").css("display","block"); },150); } }); });