I have an odd problem. I have used toggleClass before and had it working nicely. Now however only the 'class' attribute gets added to the element but no actuall class. Like this:
$("#slideButtonMenu").click(function(){
$("#sidebar").toggleClass("slideLeft");
});
.slideLeft {
left: -220px;
}
This is what I get while inspecting the element. Before click on "#slideButtonMenu":
<aside id="sidebar"> == $0
When/after clicking the button:
<aside id="sidebar" class> == $0
Wanted outcome after first click:
<aside id="sidebar" class="slideLeft"> == $0
I don't really know what the == $0
means but I don't think it affects this. If I change toggleClass to addClass it successfully adds the class... but then I obviously can't slide the menu back out again.