This function adds a rotated
class to my button when I click it. The button has an arrow on it which points in the direction the panel has slid.
How could I remove the rotated class when I click the button again?
$("#btnDiv").click(function (){
$('#slidePanel').toggle( "slide",{direction: 'right'});
$('#btnDiv').addClass('rotated');
});
Something like this maybe?
if('rotated'){
removeClass('rotated')
}else{
addClass('rotated')
}
hasClass()
: api.jquery.com/hasClass – Decapod