Instead of having a menu that redirects to separate pages, I just want my menu to show the content that corresponds to the menu item the user clicked on.
I'm using css to not display any of the contents of the sections where the content is (eg. class=services, class=contact). And I'm trying to get jQuery to show the content the user wants, then hide that content when the user clicks on another menu item and show that content.
This the basic html structure:
And this is the jQuery I'm trying:
So that when the nav is clicked everything is hidden but the content for the list item that was clicked. Could I use 'active' somehow?
I'm using css to not display any of the contents of the sections where the content is (eg. class=services, class=contact). And I'm trying to get jQuery to show the content the user wants, then hide that content when the user clicks on another menu item and show that content.
This the basic html structure:
Code:
<nav> <ul> <li class="navServe">Services</li> <li class="navContact">Contact</li> </ul> </nav> <section class="content"> <section class="services"> <p>Content for services section</p> </section> <section class="contact"> <p>Content for contact section</p> </section> </section>
Code:
$("nav").click(function() {
$(".services").hide("fast");
$(".contact").hide("fast");
$(".content").toggle("fast");
return false;
});
Comment