Difference between revisions of "Team:TU Darmstadt/Templates/SideBarMenu"
Line 187: | Line 187: | ||
//$('#menu_Bio_Safety_sec1').addClass('active'); | //$('#menu_Bio_Safety_sec1').addClass('active'); | ||
$('ul').addClass('open'); | $('ul').addClass('open'); | ||
+ | |||
+ | |||
+ | $(function () { | ||
+ | setNavigation(); | ||
+ | }); | ||
+ | |||
+ | function setNavigation() { | ||
+ | var path = window.location.pathname; | ||
+ | path = path.replace(/\/$/, ""); | ||
+ | path = decodeURIComponent(path); | ||
+ | |||
+ | $('a').each(function () { | ||
+ | var href = $(this).attr('href'); | ||
+ | if (path.substring(0, href.length) === href) { | ||
+ | $(this).addClass('active'); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
</script> | </script> | ||
</html> | </html> |
Revision as of 18:20, 17 September 2015