Team:Tec-Monterrey/ITESM14 main.js
From 2014.igem.org
(Difference between revisions)
Ejzardainc (Talk | contribs) |
Ejzardainc (Talk | contribs) |
||
(6 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
+ | <!-- Remove all empty <p> tags --> | ||
+ | $(document).ready(function() { | ||
+ | $("p").filter( function() { | ||
+ | return $.trim($(this).html()) == ''; | ||
+ | }).remove() | ||
+ | }); | ||
+ | |||
$(document).on("scroll",function(){ | $(document).on("scroll",function(){ | ||
if($(document).scrollTop()>450){ | if($(document).scrollTop()>450){ | ||
Line 120: | Line 127: | ||
$("#module4header").show(); | $("#module4header").show(); | ||
document.title = "Module 4"; | 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='#colombia']").on('shown.bs.tab', function(){ | ||
+ | $("#UANL-header").hide(); | ||
+ | $("#colombia-header").show(); | ||
+ | document.title = "Colombia"; | ||
}); | }); | ||
}); | }); | ||
Line 134: | Line 217: | ||
window.scrollTo(0,0); | window.scrollTo(0,0); | ||
} | } | ||
- | |||
// Change hash for page-reload | // Change hash for page-reload | ||
Line 141: | Line 223: | ||
}); | }); | ||
+ | /* | ||
//Javascript to enable link to tab | //Javascript to enable link to tab | ||
$('.dropdown-menu a').click(function() { | $('.dropdown-menu a').click(function() { | ||
Line 148: | Line 231: | ||
window.scrollTo(0,0); | window.scrollTo(0,0); | ||
} | } | ||
+ | });*/ | ||
+ | |||
}); | }); |
Latest revision as of 03:25, 18 October 2014
$(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='#colombia']").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); }
});*/
});