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

 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
/*跟随窗口大小的高度*/
+
/*Lazy loading*/
 
$(function(){
 
$(function(){
 +
 
var winHeight=$(window).height();
 
var winHeight=$(window).height();
if(winHeight>=380){
+
var AbstractTop=$(".Content").offset().top-$(window).scrollTop();
$(".SSTi-SZGD").css("height",winHeight);
+
 
$(".topic").css("top",winHeight*0.35);
+
if(AbstractTop<winHeight-100){
 +
setTimeout(function(){
 +
$(".Abstract").addClass("a-fadeinR");
 +
$(".Abstract").css("display","block");
 +
},150);
 
}
 
}
$(window).resize(function(){
+
winHeight = $(window).height();
+
var AbstractHeight=$(".Abstract").outerHeight();
if(winHeight>=380){
+
$(".Content").css("height",AbstractHeight);
$(".SSTi-SZGD").css("height",winHeight);
+
$(".topic").css("top",winHeight*0.35);
+
$(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);
 
}
 
}
 +
 
});
 
});
 +
 
});
 
});

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); }

});

});