Reputation: 380
Is there anyway to add a class on click and then remove that class when clicked again.
This is as far as I have got but everything I have tried to remove the class isn't working.
$(".meganav-toggle").click(function(){
$(".offcanvas-menu-left").addClass("activo");
Many thanks
Upvotes: 0
Views: 73
Reputation: 909
Use jQuery's toggle class
$(".offcanvas-menu-left").toggleClass("active")
Upvotes: 2
Reputation: 5766
$(".meganav-toggle").click(function(){
$(".offcanvas-menu-left").toggleClass("activo");
Upvotes: 2