i want to show and hide the content of my website with jquery. if i click at a link at the navigation, the content should show the <section> with a special id.
here my code:
The navigation:
$(document).ready(function(){
$("a").click(function(){
$("section#home").css({"display":"none"});
$("section#order").css({"display":"none"});
$("section#projects").css({"display":"none"});
$("section#contact").css({"display":"none"});
$("section#about").css({"display":"none"});
if ($(this[href="home"])){
$("section#home").css({"display":"block"});
} else if ($(this[href="order"])){
$("section#order").css({"display":"block"});
} else if ($(this[href="projects"])){
$("section#projects").css({"display":"block"});
} else if ($(this[href="contact"])){
$("section#contact").css({"display":"block"});
} else if ($(this[href="about"])){
$("section#about").css({"display":"block"});
}
});
});
The html-file:
<section id="content">
<section id="home">
<h1>home</h1>
</section>
<section id="order">
<h1>order</h1>
</section>
<section id="projects">
<h1>projects</h1>
</section>
<section id="contact">
<h1>contact</h1>
</section>
<section id="about">
<h1>about</h1>
</section>
</section>
It shows at every navigation-link the same page (home). What is wrong? you can look by your self at Homepage