Team:Tianjin/js/teampage

MemberGridSize();

$(window).resize(function() {

 MemberGridSize();
 $('html,body').animate({scrollTop:($('#center').offset().top - $(window).height() / 3)}, 800);

});

function MemberGridSize(){

 $('.memberGrid').each(function() {
   rowid      = $(this).attr('id')
   col1       = $('div#' + rowid).data('col');
   gridwidth1 = $('body').width() / col1;
   $('div#' + rowid + ' div.memberBlock').css("width", gridwidth1 + 'px');
   $('div#' + rowid + ' div.memberBlock').css("height", gridwidth1 + 'px'); 
 })
 
 $('.specialGrid').each(function() {
   rowid      = $(this).attr('id');                    
   gridwidth2 = $('body').width() / 5;
   gridwidth3 = gridwidth2;
   gridwidth4 = gridwidth2 * 3;
 
   $('div#' + rowid + ' div.memberBlockSlim').css("width", gridwidth3 + 'px');
   $('div#' + rowid + ' div.memberBlockSlim').css("height", gridwidth2 + 'px');
   $('div#' + rowid + ' div.centerBlock').css("width", gridwidth4 + 'px');
   $('div#' + rowid + ' div.centerBlock').css("height", gridwidth2 + 'px');                     
 })
 

}

$('.memberBlock').each(function(){

     var id = $(this).attr('id');
 
     $('#' + id).click(function(){
       $('.memberBlock.memberBlockActived').removeClass('memberBlockActived');
       $('.centerBlock').removeClass('centerBackground');
       $(this).addClass('memberBlockActived');
       $('.memberName').addClass('animated flipInX');
       $('.memberName').text($(this).data('member'));
       $('.memberName').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){$('.memberName').removeClass('animated flipInX');});
       $('.memberJob').addClass('animated fadeInLeft');
       $('.memberJob').text($(this).data('job'));
       $('.memberJob').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){$('.memberJob').removeClass('animated fadeInLeft');});
       $('.memberIntro p').addClass('animated fadeIn');
       $('.memberIntro p').text($(this).data('intro'));
       $('.memberIntro p').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){$('.memberIntro').removeClass('animated fadeIn');});
     })
   })