Binding/Unbinding click events

Binding/Unbinding click events

Can someone please help with the following. Click events are bound to 1st and 2rd anchors on dom load. It all works but not quite as desired.

1st anchor drops down a menu. 2nd drops a search field. Clicking first on a.menu opens the menu. Cliking on a.searched while menu has opened, prevents a.searched from opening its search field dropdown. Clicking on a.menu collapses the menu dropdown. Now clicking on a.searched opens it. This is correct so far. But if a.menu is clicked again wile asearched is open, it also opens menu. This bit is not desired.Conclusion, if one dropdown is opened, other needs to be disabled. If both are collapsed then any could be opened.

 Thanks for your help
ab2qik.

HTML:

<div class="box_mobile_nav">
        <a class="dropdown menu" data-target="#wrapper nav.main" href="#" id="drop_men">
          <!-- = "MENU" -->
          <img alt="Menu" src="/assets/mobile/menu-trigger.gif">
        </a>

        <a alt="Home" class="logo" href="/">
          <!-- = "logo" -->
          <img alt="Comedy" src="/assets/mobile/logo-comp.gif">
        </a>

        <a class="dropdown searched" data-target="#wrapper header .search" href="#" id="drop_searched">
          <!-- = "SEARCH" -->
          <img alt="Search" src="/assets/mobile/search-btn.gif">
        </a>
</div>

JS:

  // Menu Search dropdown
  var menu_search = function() {
    console.log('1st and second')
   
    $(this).toggleClass('open');
    $($(this).data('target')).toggle(); 
  }
  $('.dropdown').bind('click', menu_search);

  $('#drop_men').click(function() {
    console.log('1st');
    if($('#drop_men').attr('class') == 'dropdown menu open' ) {
      console.log('dropdown menu open');
      $('#drop_searched').unbind('click');   
    }
    else {
      $('#drop_searched').bind('click', menu_search); 
    }
  });

  $('#drop_searched').click(function() {
    console.log('1st');
    if($('#drop_searched').attr('class') == 'dropdown searched open' ) {
      console.log('dropdown searched open');
      $('#drop_men').unbind('click');   
    }
    else {
      $('#drop_men').bind('click', menu_search);
    }
  });