Team:TU Delft/menu test

From 2010.igem.org

(Difference between revisions)
(move code to main page)
 
(11 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 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);
 
-
  });
 
-
 
-
  var activePage = "</html>{{{contentpage|home}}}<html>";
 
-
 
-
  btn.addClass("button_pointer");
 
-
  if (page == activePage)
 
-
    btn.addClass("menu_button_"+activePage+"_sel");
 
-
   
 
-
}
 
-
 
-
// 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