Team:Tec-Monterrey/ITESM14 main.js

From 2014.igem.org

Revision as of 02:49, 18 October 2014 by Ejzardainc (Talk | contribs)

$(document).ready(function() {

   $("p").filter( function() {
       return $.trim($(this).html()) == ;
   }).remove()

});

$(document).on("scroll",function(){

   if($(document).scrollTop()>450){
       $("header").removeClass("initial-nav-scroll-up").addClass("nav-scroll-down");
       $(".mypic").fadeOut(700);
       $("#social-media").fadeOut(600);
       $("#show-menu").fadeOut(600);
       $("#igem-brand").fadeIn(600);
   } else{
       $("header").removeClass("nav-scroll-down").addClass("initial-nav-scroll-up");
       $("#navbar-control").addClass("pull-right");
       $(".mypic").fadeIn(600);
       $("#social-media").fadeIn(600);
       $("#show-menu").fadeIn(600);
       $("#igem-brand").fadeOut(700);
   }

});

$(document).on('click', '#show-menu', function(e) {

   e.preventDefault();
   if($('.left-menu').is(":visible")) {
      $('.left-menu').hide();
      $('.right-menu').hide();
      $( "#show-menu" ).removeClass("glyphicon-collapse-up");
      $( "#show-menu" ).addClass("glyphicon-collapse-down");
    }else{
      $('.left-menu').show();
      $('.right-menu').show();
      $( "#show-menu" ).removeClass("glyphicon-collapse-down");
      $( "#show-menu" ).addClass("glyphicon-collapse-up");
    }

});


$(document).ready(function(){

 $("a[href='#overview']").on('shown.bs.tab', function(){
   $("#overviewheader").show();
   $("#notebookheader").hide();
   $("#protocolsheader").hide();
   $("#modelingheader").hide();
   $("#module1header").hide();
   $("#module2header").hide();
   $("#module3header").hide();
   $("#module4header").hide();
   document.title = "Overview";
 });
 $("a[href='#notebook']").on('shown.bs.tab', function(){
   $("#overviewheader").hide();
   $("#notebookheader").show();
   $("#protocolsheader").hide();
   $("#modelingheader").hide();
   $("#module1header").hide();
   $("#module2header").hide();
   $("#module3header").hide();
   $("#module4header").hide();
   document.title = "Notebook";
 });
 $("a[href='#protocols']").on('shown.bs.tab', function(){
   $("#overviewheader").hide();
   $("#notebookheader").hide();
   $("#protocolsheader").show();
   $("#modelingheader").hide();
   $("#module1header").hide();
   $("#module2header").hide();
   $("#module3header").hide();
   $("#module4header").hide();
   document.title = "Protocols";
 });
 $("a[href='#modeling']").on('shown.bs.tab', function(){
   $("#overviewheader").hide();
   $("#notebookheader").hide();
   $("#protocolsheader").hide();
   $("#modelingheader").show();
   $("#module1header").hide();
   $("#module2header").hide();
   $("#module3header").hide();
   $("#module4header").hide();
   document.title = "Modeling";
 });
 $("a[href='#module1']").on('shown.bs.tab', function(){
   $("#overviewheader").hide();
   $("#notebookheader").hide();
   $("#protocolsheader").hide();
   $("#modelingheader").hide();
   $("#module1header").show();
   $("#module2header").hide();
   $("#module3header").hide();
   $("#module4header").hide();
   document.title = "Module 1";
 });
 $("a[href='#module2']").on('shown.bs.tab', function(){
   $("#overviewheader").hide();
   $("#notebookheader").hide();
   $("#protocolsheader").hide();
   $("#modelingheader").hide();
   $("#module1header").hide();
   $("#module2header").show();
   $("#module3header").hide();
   $("#module4header").hide();
   document.title = "Module 2";
 });
 $("a[href='#module3']").on('shown.bs.tab', function(){
   $("#overviewheader").hide();
   $("#notebookheader").hide();
   $("#protocolsheader").hide();
   $("#modelingheader").hide();
   $("#module1header").hide();
   $("#module2header").hide();
   $("#module3header").show();
   $("#module4header").hide();
   document.title = "Module 3";
 });
 $("a[href='#module4']").on('shown.bs.tab', function(){
   $("#overviewheader").hide();
   $("#notebookheader").hide();
   $("#protocolsheader").hide();
   $("#modelingheader").hide();
   $("#module1header").hide();
   $("#module2header").hide();
   $("#module3header").hide();
   $("#module4header").show();
   document.title = "Module 4";
 });

});

$(document).ready(function(){

 $("a[href='#law-proposal']").on('shown.bs.tab', function(){
   $("#law-proposal-header").show();
   $("#kids-health-header").hide();
   $("#3k-cancer-header").hide();
   document.title = "Cancer in México";
 });
 $("a[href='#kids-health']").on('shown.bs.tab', function(){
   $("#law-proposal-header").hide();
   $("#kids-health-header").show();
   $("#3k-cancer-header").hide();
   document.title = "Kids and Health";
 });
 $("a[href='#3k-cancer']").on('shown.bs.tab', function(){
  $("#law-proposal-header").hide();
   $("#kids-health-header").hide();
   $("#3k-cancer-header").show();
   document.title = "3K Against Cancer";
 });

});

$(document).ready(function(){

 $("a[href='#overview-safety']").on('shown.bs.tab', function(){
   $("#overview-safety-header").show();
   $("#safety-protocols-header").hide();
   $("#safety-project-header").hide();
   document.title = "Safety Overview";
 });
 $("a[href='#safety-protocols']").on('shown.bs.tab', function(){
   $("#overview-safety-header").hide();
   $("#safety-protocols-header").show();
   $("#safety-project-header").hide();
   document.title = "Safety Protocols";
 });
 $("a[href='#safety-project']").on('shown.bs.tab', function(){
   $("#overview-safety-header").hide();
   $("#safety-protocols-header").hide();
   $("#safety-project-header").show();
   document.title = "Project Safety";
 });

});

$(document).ready(function(){

 $("a[href='#medal-fulfillment']").on('shown.bs.tab', function(){
   $("#medal-fulfillment-header").show();
   $("#results-header").hide();
   $("#bio-bricks-header").hide();
   document.title = "Medal Fulfillment";
 });
 $("a[href='#results']").on('shown.bs.tab', function(){
   $("#medal-fulfillment-header").hide();
   $("#results-header").show();
   $("#bio-bricks-header").hide();
   document.title = "Results";
 });
 $("a[href='#bio-bricks']").on('shown.bs.tab', function(){
   $("#medal-fulfillment-header").hide();
   $("#results-header").hide();
   $("#bio-bricks-header").show();
   document.title = "Biobricks";
 });

});

$(document).ready(function(){

 $("a[href='#UANL']").on('shown.bs.tab', function(){
   $("#UANL-header").show();
   $("#colombia-header").hide();
   document.title = "UANL";
 });
 $("a[href='#results']").on('shown.bs.tab', function(){
   $("#UANL-header").hide();
   $("#colombia-header").show();
   document.title = "Colombia";
 });

});


// Javascript to enable link to tab $(document).ready(function(){ var hash = document.location.hash; var prefix = "tab_";

if (hash) {

   $('.nav-tabs a[href='+hash.replace(prefix,"")+']').tab('show');
   $(hash.replace(prefix,"") + 'header').show();
   window.scrollTo(0,0);

}

// Change hash for page-reload $('.nav-tabs a').on('shown.bs.tab', function (e) {

   window.location.hash = e.target.hash.replace("#", "#" + prefix);

});

/* //Javascript to enable link to tab $('.dropdown-menu a').click(function() { var url = document.location.toString();

 if (url.match('#')) {
     $('.nav-tabs a[href=#'+url.split('#')[1]+']').tab('show');
     window.scrollTo(0,0);
 }

});*/

});