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

Line 1: Line 1:
/*跟随窗口大小的高度*/
+
/*Follow the height of the window size*/
 
$(function(){
 
$(function(){
 
 
Line 34: Line 34:
 
});
 
});
  
/*延时加载*/
+
/*Lazy loading*/
 
$(function(){
 
$(function(){
 
 

Revision as of 16:28, 23 September 2017

/*Follow the height of the window size*/ $(function(){

var winHeight=$(window).height();

if(winHeight>=465){ $(".SSTi-SZGD").css("height",winHeight); $(".topic").css("top",winHeight*0.35); } else{ winHeight=465; $(".SSTi-SZGD").css("height",winHeight); $(".topic").css("top",winHeight*0.35); }

$(window).resize(function(){

winHeight=$(window).height();

if(winHeight>=465){ $(".SSTi-SZGD").css("height",winHeight); $(".topic").css("top",winHeight*0.35); }else{ winHeight=465; $(".SSTi-SZGD").css("height",winHeight); $(".topic").css("top",winHeight*0.35); }

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

});

});

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

});

});