Team:Valencia UPV/Modeling/gene expresion

From 2014.igem.org

(Difference between revisions)
(Created page with "{{:Team:Valencia_UPV/header}} {{:Team:Valencia_UPV/footer_img}}")
Line 1: Line 1:
{{:Team:Valencia_UPV/header}}
{{:Team:Valencia_UPV/header}}
 +
<html>
 +
$('#overlay').width($(window).width()).height($(window).height());
 +
$(document).ready(function() {
 +
  // cache the id
 +
  var navbox = $('#myTab');
 +
  // activate tab on click
 +
  navbox.on('click', 'a', function (e) {
 +
      // add a hash to the URL when the user clicks on a tab
 +
      history.pushState(null, null, $(this).attr('href'));
 +
      var $this = $(this);
 +
      // prevent the Default behavior
 +
      e.preventDefault();
 +
      // set the hash to the address bar
 +
      window.location.hash = $this.attr('href');
 +
      // activate the clicked tab
 +
      $this.tab('show');
 +
      //return false;
 +
  })
 +
  // if we have a hash in the address bar
 +
  if(window.location.hash){
 +
    // show right tab on load (read hash from address bar)
 +
    $('a[href="'+window.location.hash+'"]').tab('show');
 +
  }
 +
 +
  // navigate to a tab when the history changes
 +
  window.addEventListener("popstate", function(e) {
 +
    var activeTab = $('[href=' + location.hash + ']');
 +
    if (activeTab.length) {
 +
        activeTab.tab('show');
 +
    } else {
 +
        $('.nav-tabs a:first').tab('show');
 +
    }
 +
  });
 +
});
 +
</script>
 +
 +
<ul class="nav nav-tabs" id="myTab">
 +
    <li class="active"><a href="#Devices_Overview">Devices Overview</a></li>
 +
    <li><a href="#Hardware">Hardware</a></li>
 +
    <li><a href="#Software">Software</a></li>
 +
            <li><a href="#Results">Results</a></li>
 +
    </ul>
 +
</html>
{{:Team:Valencia_UPV/footer_img}}
{{:Team:Valencia_UPV/footer_img}}

Revision as of 14:07, 3 September 2014

$('#overlay').width($(window).width()).height($(window).height()); $(document).ready(function() { // cache the id var navbox = $('#myTab'); // activate tab on click navbox.on('click', 'a', function (e) { // add a hash to the URL when the user clicks on a tab history.pushState(null, null, $(this).attr('href')); var $this = $(this); // prevent the Default behavior e.preventDefault(); // set the hash to the address bar window.location.hash = $this.attr('href'); // activate the clicked tab $this.tab('show'); //return false; }) // if we have a hash in the address bar if(window.location.hash){ // show right tab on load (read hash from address bar) $('a[href="'+window.location.hash+'"]').tab('show'); } // navigate to a tab when the history changes window.addEventListener("popstate", function(e) { var activeTab = $('[href=' + location.hash + ']'); if (activeTab.length) { activeTab.tab('show'); } else { $('.nav-tabs a:first').tab('show'); } }); });