Team:BIT-China/js/index.js

From 2013.igem.org

Revision as of 02:15, 26 September 2013 by Singlewindy (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
function scrollToElement(e,t,n){$("html,body").animate({scrollTop:$("#"+e).offset().top+n},t,function(){})}function flipdown(){var e=$(window),t=$("#sitemap").offset().top-110,n=$("#story").offset().top-110,r=$("#about").offset().top-110,i=$("#contact").offset().top-110;if(e.scrollTop()<t){scrollToElement("sitemap","slow",425);return}if(e.scrollTop()<n){scrollToElement("story","slow",75);return}if(e.scrollTop()<r){scrollToElement("about","slow",105);return}if(e.scrollTop()<i){scrollToElement("contact","slow",0);return}scrollToElement("contact","slow",200);return}function autoScroll(){scrollRight()}function scrollRight(){global_current_elem==3?global_current_elem=0:global_current_elem+=1,$("#myCarousel").carousel(global_current_elem),set_active_btn(global_current_elem+1),global_current_elem==0&&$("#story1_gem").css("opacity","1")}function scrollLefty(){global_current_elem==0?global_current_elem=3:global_current_elem-=1,$("#myCarousel").carousel(global_current_elem),set_active_btn(global_current_elem+1)}function set_active_btn(e){jQuery("#aktuals1_btn").removeClass("active"),jQuery("#aktuals2_btn").removeClass("active"),jQuery("#aktuals3_btn").removeClass("active"),jQuery("#aktuals4_btn").removeClass("active"),jQuery("#aktuals"+e+"_btn").addClass("active")}function change(e){$("#myCarousel").carousel(e-1),jQuery("#aktuals1_btn").removeClass("active"),jQuery("#aktuals2_btn").removeClass("active"),jQuery("#aktuals3_btn").removeClass("active"),jQuery("#aktuals4_btn").removeClass("active"),jQuery("#aktuals"+e+"_btn").addClass("active")}function isInfoBoxOpen(e){var t=e.getMap();return t===null||typeof t=="undefined"}function initialize(){var e=new google.maps.LatLng(39.959758,116.31615),t={zoom:11,center:e,mapTypeId:google.maps.MapTypeId.ROADMAP};map=new google.maps.Map(document.getElementById("googlemap"),t);var r=document.createElement("div");r.innerHTML="<aside class='hatch'>
<img src='./img/sponsers/BIT.png' width='100'/>
School</dt>
Beijing Institute Of Technology</dd>
Postcode</dt>
100081</dd>
Address</dt>
5 South Zhongguancun Street, Haidian District, Beijing</dd>
Email</dt>
singlewindy@gmail.com</dd>
</aside>";var i={content:r,disableAutoPan:!1,maxWidth:0,pixelOffset:new google.maps.Size(-140,0),zIndex:null,boxStyle:{},infoBoxClearance:new google.maps.Size(1,1),closeBoxURL:"",isHidden:!1,pane:"floatPane",enableEventPropagation:!1},s=new InfoBox(i);marker=new google.maps.Marker({position:e,map:map,draggable:!0,animation:google.maps.Animation.DROP}),s.open(map,marker),google.maps.event.addListener(marker,"click",toggleBounce),google.maps.event.addListener(marker,"click",function(){isInfoBoxOpen(s)?s.open(map,marker):s.close(map,marker),n+=1})}function toggleBounce(){if(marker.getAnimation()!=null)marker.setAnimation(null);else{marker.setAnimation(google.maps.Animation.BOUNCE);for(var e=0;e<=1e3;e++);marker.setAnimation(null)}}(function(){var e=$(window);e.scroll(function(){$(".header-icon div, .wrap > h1, .wrap > h2, #googlemap").each(function(t){var n=$(this).offset().top;if(e.scrollTop()>=n-400&&$(this).hasClass("invisible")){$(this).removeClass("invisible");if($(this).is(".header-icon div")){var r=this;setTimeout(function(){$(r).parent().removeClass("invisible")},1e3),$(this).animate({height:128,marginLeft:0,marginTop:0,opacity:1,width:128},{duration:1e3,queue:!1})}else $(this).animate({marginLeft:0,opacity:1},{duration:500})}else e.scrollTop()<n-400&&!$(this).hasClass("invisible")&&($(this).addClass("invisible"),$(this).is(".header-icon div")?($(this).parent().addClass("invisible"),$(this).animate({height:0,marginLeft:64,marginTop:64,opacity:0,width:0},{duration:500,queue:!1})):$(this).animate({marginLeft:t%2?-284:284,opacity:0},{duration:500,queue:!1}))}),$("#sitemap section, .sun").each(function(t){var n=$(this).offset().top-300,r=$(this).offset().top-400,i=$(this),s;$(this).is(".sun")?s="sunentrance":s="bounce",e.scrollTop()>=n&&!i.hasClass(s)?i.css({opacity:1,zIndex:3}).addClass(s):e.scrollTop()<r&&i.hasClass(s)&&i.removeClass(s).animate({opacity:0},{duration:100,queue:!1,complete:function(){$(this).css("zIndex",-1)}})})}),$(document).ready(function(){$("#idea").hover(function(){$("#idea").css("background-color","rgba(58, 153, 211, 0.85)"),$("#advantage").css("background-color","rgba(0, 0, 0, 0)"),$("#description").css("background-color","rgba(0, 0, 0, 0)"),$("#charactors").css("background-color","rgba(0, 0, 0, 0)"),$("#extend").css("background-color","rgba(0, 0, 0, 0)"),$("#laptop-screen").css("background","rgba(58, 153, 211, 0.85)"),$("#cover").css("background-color","rgb(58, 153, 211)"),$("#display-img-idea").css("display","block"),$("#display-img-idea").css("visibility","visible"),$("#display-img-advantage").css("display","none"),$("#display-img-advantage").css("visibility","hidden"),$("#display-img-description").css("display","none"),$("#display-img-description").css("visibility","hidden"),$("#display-img-charactors").css("display","none"),$("#display-img-charactors").css("visibility","hidden"),$("#display-img-extend").css("display","none"),$("#display-img-extend").css("visibility","hidden")},function(){}),$("#advantage").hover(function(){$("#idea").css("background-color","rgba(0, 0, 0, 0)"),$("#advantage").css("background-color","rgba(118, 181, 71, 0.85098)"),$("#description").css("background-color","rgba(0, 0, 0, 0)"),$("#charactors").css("background-color","rgba(0, 0, 0, 0)"),$("#extend").css("background-color","rgba(0, 0, 0, 0)"),$("#laptop-screen").css("background","rgba(118, 181, 71, 0.85098)"),$("#cover").css("background-color","rgb(118, 181, 71)"),$("#display-img-advantage").css("display","block"),$("#display-img-advantage").css("visibility","visible"),$("#display-img-idea").css("display","none"),$("#display-img-idea").css("visibility","hidden"),$("#display-img-description").css("display","none"),$("#display-img-description").css("visibility","hidden"),$("#display-img-charactors").css("display","none"),$("#display-img-charactors").css("visibility","hidden"),$("#display-img-extend").css("display","none"),$("#display-img-extend").css("visibility","hidden")},function(){}),$("#description").hover(function(){$("#idea").css("background-color","rgba(0, 0, 0, 0)"),$("#advantage").css("background-color","rgba(0, 0, 0, 0)"),$("#description").css("background-color","rgba(234, 58, 58, 0.85098)"),$("#charactors").css("background-color","rgba(0, 0, 0, 0)"),$("#extend").css("background-color","rgba(0, 0, 0, 0)"),$("#laptop-screen").css("background","rgba(234, 58, 58, 0.85)"),$("#cover").css("background-color","rgb(234, 58, 58)"),$("#display-img-description").css("display","block"),$("#display-img-description").css("visibility","visible"),$("#display-img-advantage").css("display","none"),$("#display-img-advantage").css("visibility","hidden"),$("#display-img-idea").css("display","none"),$("#display-img-idea").css("visibility","hidden"),$("#display-img-charactors").css("display","none"),$("#display-img-charactors").css("visibility","hidden"),$("#display-img-extend").css("display","none"),$("#display-img-extend").css("visibility","hidden")},function(){}),$("#charactors").hover(function(){$("#idea").css("background-color","rgba(0, 0, 0, 0)"),$("#advantage").css("background-color","rgba(0, 0, 0, 0)"),$("#description").css("background-color","rgba(0, 0, 0, 0)"),$("#charactors").css("background-color","rgba(133, 133, 197, 0.85098)"),$("#extend").css("background-color","rgba(0, 0, 0, 0)"),$("#laptop-screen").css("background","rgba(133, 133, 197, 0.85098)"),$("#cover").css("background-color","rgb(133, 133, 197)"),$("#display-img-charactors").css("display","block"),$("#display-img-charactors").css("visibility","visible"),$("#display-img-advantage").css("display","none"),$("#display-img-advantage").css("visibility","hidden"),$("#display-img-description").css("display","none"),$("#display-img-description").css("visibility","hidden"),$("#display-img-idea").css("display","none"),$("#display-img-idea").css("visibility","hidden"),$("#display-img-extend").css("display","none"),$("#display-img-extend").css("visibility","hidden")},function(){}),$("#extend").hover(function(){$("#idea").css("background-color","rgba(0, 0, 0, 0)"),$("#advantage").css("background-color","rgba(0, 0, 0, 0)"),$("#description").css("background-color","rgba(0, 0, 0, 0)"),$("#charactors").css("background-color","rgba(0, 0, 0, 0)"),$("#extend").css("background-color","rgba(255, 165, 0, 0.85098)"),$("#laptop-screen").css("background","rgba(255, 165, 0, 0.85098)"),$("#cover").css("background-color","rgb(255, 165, 0)"),$("#display-img-extend").css("display","block"),$("#display-img-extend").css("visibility","visible"),$("#display-img-advantage").css("display","none"),$("#display-img-advantage").css("visibility","hidden"),$("#display-img-description").css("display","none"),$("#display-img-description").css("visibility","hidden"),$("#display-img-charactors").css("display","none"),$("#display-img-charactors").css("visibility","hidden"),$("#display-img-idea").css("display","none"),$("#display-img-idea").css("visibility","hidden")},function(){})})})(),global_current_elem=0;var interval_variable=setInterval("autoScroll()",8e3),map,marker,n=0;google.maps.event.addDomListener(window,"load",initialize)