Reversing animation of my menu on second click

Reversing animation of my menu on second click

Hello everyone!

This is my first post as I am just starting with jQuery.

I am trying to reverse drop down animation of my menu on second click like this-

$('.spinner-master').click(function() { if($('.inner:not(".animateinner")')){ $('.inner').addClass('animateinner') }else if ($('.inner').hasClass('animateinner')){ $('.inner').removeClass('animateinner').addClass('animateinnerrev') } });
You can see it here:


The menu opens but it does not close (reverse) on second click. Any idea why the second part isn't working?