Have this jquery function that always gives me the second function every time i click. How can I stop this?
I have a navbar that has 3 links and for every link i have a .contentDiv with different id's. Every time somone clicks on one of those links the toggle function takes place; hiding all .contentDiv expect the one that is linked to that link. and an animation of sliding to the left occurs to that one .contentDiv
HTML:
.navbar
ul
li
a.about(href='#') About
span
span
li
a#portfolio(href='#') HOME
span
span
li
a(href='#') Contact
span
span
.contentDiv#portfolioContent
.title About
.content
.fse
p Lorem ipsum dolor sit amet, consectetur adipiscing elit.
CSS:
.contentDiv {
transform: skew(45deg);
width: 100%;
height: 100%;
position: relative;
top: 5%;
left: 300%;
overflow: hidden;
}
.title {
position: absolute;
top: 30%;
left: 30%;
font-size: 500%;
font-family: Raleway;
font-weight: 800;
color: #EAEBED;
}
.content {
width: 100%;
height: 50%;
top: 43%;
left: 3%;
font-size: 130%;
font-family: Raleway;
color: #EAEBED;
position: absolute;
overflow:scroll;
padding-bottom: 7%;
}
Jquery:
$('.about').click(function () {
$("#aboutContent").toggle(
function() {
$("#aboutContent").animate({left: "115%"}, { //coming out of hiding
duration: 2000
});
}, function() {
$("#aboutContent").animate({left: "300%"}, { //back into hiding
duration: 2000
});
}
);
});