Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  14] [ 4]  / answers: 1 / hits: 15232  / 11 Years ago, wed, february 27, 2013, 12:00:00

I'm having trouble getting the else bit of this working. Anyone know what the problem is?



var navOpen = false;
if (navOpen == false) {
$(nav).click(function() {
$(this).css(bottom,0);
navOpen = true;
});
} else {
$(nav).click(function() {
$(this).css(bottom,-84);
navOpen = false;
});
}

More From » jquery

 Answers
0

The condition is in the wrong place.



 var navOpen = false;
$(nav).click(function() {
if (navOpen == false) {
$(this).css(bottom,0);
navOpen = true;
} else {
$(this).css(bottom,-84px);
navOpen = false;
}
});

[#79974] Tuesday, February 26, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nestorjarettg

Total Points: 451
Total Questions: 108
Total Answers: 108

Location: Rwanda
Member since Thu, Feb 10, 2022
2 Years ago
;