Why is the button still disabled?

Hi, I have this little script:

$(document).ready(function(){

  var menu = $("#push-menu");
  var toggleMenu = $(".toggle-push-menu");
  var toggleBody = $('body, header');

  toggleMenu.on('click', function(){
      menu.toggleClass('show-push-menu-left');
      toggleBody.toggleClass('push-right');
      if (menu.hasClass('show-push-menu-left')){
        $('.toggle-push-basket').prop('disabled', true);
      } else {
        $('.toggle-push-basket').prop('disabled', false);
      }
  });

  $(document).click(function (e){

    var buttonContainer = $('header');

    if (!menu.is(e.target) && !buttonContainer.is(e.target)) {
      menu.removeClass('show-push-menu-left');
      toggleBody.removeClass('push-right');
    }

  });

  $('.toggle-push-menu, #push-menu ul li button, #push-menu ul li a').click(function(e) {
    e.stopPropagation();
  });

});

And as u can see I have a if statement for disabling another button depending on if “menu” has class “show-push-menu-left”. This works fine except if i close menu by clicking outside the element (in other words, not using the toggleMenu button). If i close the menu by clicking outside the .toggle-push-basket button is still disabled.

I am a noob at jQuery so if someone could help me with this I would be very grateful.

Which version of jQuery are you using?
If you give us link to your script, it will be easy to find the problem quickly.