Benjamin Stoner
Benjamin Stoner

Reputation: 25

Help with .removeclass issue

Ok im a bit of a novice when it comes to javascript but i have been giving it a go with the help of the jquery library.

I have a navbar with 3 links which upon clicking expand a relevant div on the page and also adds/removes the "current" class to which ever button you press. There is also a close button within the expanded div when this is pressed the div collapses again and the "current" is removed from the links but for some reason the link which was last pressed is not losing the class and staying in the "current" state.

Link to the code in action

Any help will be appreciated.

Upvotes: 0

Views: 64

Answers (2)

Pointy
Pointy

Reputation: 414086

The problem is that there's no such method as ".fadeto()"; it's "fadeTo()", capital "T".

You could condense that code a whole lot. There's no reason to have three nearly-identical handlers for three nearly-identical DOM chunks.

edit — also, by way of advice: the first thing you should do when something unexpected happens is check the JavaScript console for errors. That's all I did to find the issue.

Upvotes: 2

Adam Bergmark
Adam Bergmark

Reputation: 7566

See fadeTo docs, it seems you are applying the callback argument to the opacity parameter.

Upvotes: 1

Related Questions