Team:TU Delft/menu test
From 2010.igem.org
(Difference between revisions)
Line 69: | Line 69: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
- | function | + | var pageCache = {}; |
- | var btn= $(".menu_button_" + | + | |
- | var page = "https://2010.igem.org/Team:TU_Delft/pages/" + | + | function isUndefined(x) { var u; return x === u; } |
- | btn.click(function() { | + | |
- | + | function setupPage(page) { | |
+ | var btn= $(".menu_button_" + page); | ||
+ | var page = "https://2010.igem.org/Team:TU_Delft/pages/" + page + "?action=render"; | ||
+ | btn.click(function() { | ||
+ | var main_td = $(#main_td"); | ||
+ | main_td.fadeOut(200); | ||
+ | $.get(page, function(data) { | ||
+ | main_td.html(data); | ||
+ | main_td.fadeIn(200); | ||
+ | }); | ||
}); | }); | ||
Line 88: | Line 97: | ||
// this runs when page is loaded | // this runs when page is loaded | ||
$(function() { | $(function() { | ||
- | var | + | var pages = [ "home", "blog", "competition", "background", "project", "education", "sponsors", "press" ]; |
- | for(var i in | + | for(var i in pages) { |
- | + | setupPage(pages[i]); | |
- | + | } | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | } | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
}); | }); | ||
- | |||
</script> | </script> | ||
</html> | </html> |
Revision as of 23:01, 4 June 2010