I've created some quick jQuery toggle code:
$("#expander.closed").click(function(){
console.log("opening");
$("#expander").removeClass();
$("#expander").addClass("open");
});
$("#expander.open").click(function(){
console.log("closing");
$("#expander").removeClass();
$("#expander").addClass("closed");
});
The idea is that everytime you click #expander
the class toggles between open
and closed
.
However, for some reason, it only works once, changing from closed
to open
, and then goes no further.
I have no clue why. Here's a jsFiddle.