Reputation: 1
I can go to the different pages by clicking on MENU, but not back to the first page (index.php).
This is the Javascript function, which I put in the head:
function toggle_visibility(id) {
var e = document.getElementById(id);
e.style.display = (e.style.display === 'block') ? 'none' : 'block';
}
This is the navigation in the body:
<nav>
<a href="index.php" onclick="toggle_visibility('menu');
return false">
MENU
</a>
<div id="menu" style="display:none;">
<a href="seite1.php" onclick="toggle_visibility('submenu');
return false">
POINT1
</a>
<div id="submenu" style="display:none;">
<a href="seite2.php">
POINT 2
</a>
<a href="seite3.php">
POINT 3
</a>
</div>
<a href="seite4.php">
POINT 4
</a>
<a href="seite5.php">
POINT 5
</a>
</div>
</nav>
Thank you very much for helping... :)
Upvotes: 0
Views: 27
Reputation: 15489
the "return false" is preventing the normal action of the <a>
link causing the link to not be functional.
you need to remove that in order for it to be a navlink.
<a href="index.php" onclick="toggle_visibility('menu')">
MENU
</a>
I am trying to work out why you have the two return falses' in there but I can't see it - you are toggling the visibility of the menu and sub mienu, but I am not sure why the return false is needed.
Upvotes: 1