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

 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
/*跟随窗口大小的高度*/
+
/*Lazy loading*/
$(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(){
 
$(function(){
 
 
 
var winHeight=$(window).height();
 
var winHeight=$(window).height();
 
var AbstractTop=$(".Content").offset().top-$(window).scrollTop();
 
var AbstractTop=$(".Content").offset().top-$(window).scrollTop();
var footerTop=$(".footer_box").offset().top-$(window).scrollTop();
+
 
+
if(footerTop<winHeight-100){
+
setTimeout(function(){
+
$(".footer").addClass("a-fadeinB");
+
$(".footer").css("display","block");
+
},150);
+
}
+
+
 
if(AbstractTop<winHeight-100){
 
if(AbstractTop<winHeight-100){
 
setTimeout(function(){
 
setTimeout(function(){
Line 44: Line 11:
 
},150);
 
},150);
 
}
 
}
 +
 +
var AbstractHeight=$(".Abstract").outerHeight();
 +
$(".Content").css("height",AbstractHeight);
 
 
 
$(window).scroll(function(){
 
$(window).scroll(function(){
Line 49: Line 19:
 
winHeight=$(window).height();
 
winHeight=$(window).height();
 
AbstractTop=$(".Content").offset().top-$(window).scrollTop();
 
AbstractTop=$(".Content").offset().top-$(window).scrollTop();
footerTop=$(".footer_box").offset().top-$(window).scrollTop();
 
 
 
if(footerTop<winHeight-100){
+
if(AbstractTop<winHeight-100){
 
setTimeout(function(){
 
setTimeout(function(){
$(".footer").addClass("a-fadeinB");
+
$(".Abstract").addClass("a-fadeinR");
$(".footer").css("display","block");
+
$(".Abstract").css("display","block");
 
},150);
 
},150);
 
}
 
}
 
if(AbstractTop<winHeight-100){
 
setTimeout(function(){
 
$(".Abstract").addClass("a-fadeinR");
 
$(".Abstract").css("display","block");
 
},150);
 
}
 
 
 
 
});
 
});
 
 
 
});
 
});

Latest revision as of 10:53, 29 October 2017

/*Lazy loading*/ $(function(){

var winHeight=$(window).height(); var AbstractTop=$(".Content").offset().top-$(window).scrollTop();

if(AbstractTop<winHeight-100){ setTimeout(function(){ $(".Abstract").addClass("a-fadeinR"); $(".Abstract").css("display","block"); },150); }

var AbstractHeight=$(".Abstract").outerHeight(); $(".Content").css("height",AbstractHeight);

$(window).scroll(function(){

winHeight=$(window).height(); AbstractTop=$(".Content").offset().top-$(window).scrollTop();

if(AbstractTop<winHeight-100){ setTimeout(function(){ $(".Abstract").addClass("a-fadeinR"); $(".Abstract").css("display","block"); },150); }

});

});