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