Team:EPF-Lausanne/Template/SubMenu
From 2012.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
<html> | <html> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
- | + | var menu = "</html>{{{1}}}<html>"; | |
+ | |||
+ | var menus = { | ||
+ | Home: [ | ||
+ | ["Test", "#"], | ||
+ | ["Test2", "#"] | ||
+ | ], | ||
+ | Team: [ | ||
+ | ["Test3", "#"], | ||
+ | ["Test4", "#"] | ||
+ | ] | ||
+ | }; | ||
</script> | </script> | ||
<div class="sub-menu"> | <div class="sub-menu"> | ||
- | < | + | <div class='simple-navi'> |
- | + | <ul> | |
- | + | ||
+ | </ul> | ||
+ | </div> | ||
<div style="clear: both"></div> | <div style="clear: both"></div> | ||
</div> | </div> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | if(menus[menu]){ | ||
+ | var sub = $(".sub-menu .simple-navi ul"); | ||
+ | |||
+ | sub.append($("<li>").attr("class", "left").append($("<span>"))); | ||
+ | |||
+ | for(var i = 0; i < menus[menu].length; i++){ | ||
+ | sub.append($("<li>") | ||
+ | .append($("<a>") | ||
+ | .attr("href", menus[menu][i][1]) | ||
+ | .append($("<span>").text(menus[menu][i][0])))); | ||
+ | } | ||
+ | |||
+ | sub.append($("<li>").attr("class", "right").append($("<span>"))); | ||
+ | } | ||
+ | </script> | ||
</html> | </html> |
Latest revision as of 16:32, 13 September 2012