Team:TU Delft/menu test

From 2010.igem.org

(Difference between revisions)
(move code to main page)
 
(14 intermediate revisions not shown)
Line 2: Line 2:
<style>
<style>
 +
a:hover {
 +
text-decoration: none;
 +
}
 +
 +
#navlist {
 +
margin: 0;
 +
padding: 0;
 +
margin-left: 8px;
 +
}
 +
 +
#navlist li {
 +
display: block;
 +
list-style-type: none;
 +
float:left;
 +
padding: 0;
 +
margin: 0;
 +
}
 +
 +
.menu_button {
 +
display:block;
 +
color: #fff;
 +
border: none;
 +
background-repeat: none;
 +
height:45px;
 +
cursor: pointer;
 +
}
.menu_button_home {
.menu_button_home {
Line 61: Line 87:
</style>
</style>
<ul id="navlist">
<ul id="navlist">
-
<li><a class="menu_button menu_button_home menu_button_home_sel" href="https://2010.igem.org/Team:TU_Delft" title="Home">&nbsp;</a></li>
+
<li><a class="menu_button menu_button_home" href="https://2010.igem.org/Team:TU_Delft" title="Home">&nbsp;</a></li>
<li><a class="menu_button menu_button_blog" href="https://2010.igem.org/Team:TU_Delft/blog" title="Blog">&nbsp;</a></li>
<li><a class="menu_button menu_button_blog" href="https://2010.igem.org/Team:TU_Delft/blog" title="Blog">&nbsp;</a></li>
<li><a class="menu_button menu_button_competition" href="https://2010.igem.org/Team:TU_Delft/competition" title="Competition">&nbsp;</a></li>
<li><a class="menu_button menu_button_competition" href="https://2010.igem.org/Team:TU_Delft/competition" title="Competition">&nbsp;</a></li>
Line 71: Line 97:
</ul>
</ul>
<style>
<style>
-
.button_pointer { cursor:pointer; }
 
.button_hover { background-color: #aaa; }
.button_hover { background-color: #aaa; }
</style>
</style>
-
 
 
-
<script type="text/javascript">
 
-
 
-
function isUndefined(x) { var u; return x === u; }
 
-
 
-
function setupPage(page) {
 
-
  var btn= $(".menu_button_" + page);
 
-
  var pageURL = "https://2010.igem.org/Team:TU_Delft/pages/" + page + "?action=render";
 
-
  btn.click(function() {
 
-
    var cpw = $("#content_page_wrap");
 
-
    cpw.fadeOut(200);
 
-
    $.get(pageURL, function(data) {
 
-
        cpw.html(data);
 
-
        cpw.fadeIn(200);
 
-
    });
 
-
  });
 
-
 
-
  // setup hovering
 
-
  var btnCssClassSelected = "menu_button_" + page + "_sel";
 
-
  btn.hover(function() {
 
-
    btn.addClass(btnCssClassSelected);
 
-
  }, function() {
 
-
    btn.removeClass(btnCssClassSelected);
 
-
  });
 
-
 
-
  btn.addClass("button_pointer");
 
-
}
 
-
 
-
// this runs when page is loaded
 
-
$(function() {
 
-
  var pages = [ "home", "blog", "competition", "background", "project", "education", "sponsors", "press" ];
 
-
  for(var i in pages)  {
 
-
    setupPage(pages[i]);
 
-
  }
 
-
});
 
-
</script>
 
</html>
</html>

Latest revision as of 16:47, 7 June 2010