title: Wordpress - main navigation click to open sub-menu
body: <p>I've been stumped by the site i'm working.</p>
  
  <p>On some browsers it opens and closes the sub menu when hovering, on others it works by clicking and they stay open when on a page in the sub menu. I want to force sub menu navigation by clicking text &amp; arrow and remove hovering to open sub menu completely. Anyone know how to go about this?</p>
  
  <p>Some parts of the code:</p>
  
  <p>css</p>
  
  <pre><code>.caret {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 2px;
    vertical-align: middle;
    border-top: 4px solid;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
  }
  .dropup,
  .dropdown {
    position: relative;
  }
  .dropdown-toggle:focus {
    outline: 0;
  }
  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    float: left;
    min-width: 160px;
    padding: 5px 0;
    margin: 2px 0 0;
    list-style: none;
    font-size: 16px;
    text-align: left;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
    -webkit-background-clip: padding-box;
            background-clip: padding-box;
  }
  .dropdown-menu.pull-right {
    right: 0;
    left: auto;
  }
  .dropdown-menu .divider {
    height: 1px;
    margin: 12px 0;
    overflow: hidden;
    background-color: #e5e5e5;
  }
  .dropdown-menu &gt; li &gt; a {
    display: block;
    padding: 3px 20px;
    clear: both;
    font-weight: normal;
    line-height: 1.625;
    color: #333333;
    white-space: nowrap;
  }
  .dropdown-menu &gt; li &gt; a:hover,
  .dropdown-menu &gt; li &gt; a:focus {
    text-decoration: none;
    color: #262626;
    background-color: #f5f5f5;
  }
  .dropdown-menu &gt; .active &gt; a,
  .dropdown-menu &gt; .active &gt; a:hover,
  .dropdown-menu &gt; .active &gt; a:focus {
    color: #ffffff;
    text-decoration: none;
    outline: 0;
    background-color: #3699dc;
  }
  .dropdown-menu &gt; .disabled &gt; a,
  .dropdown-menu &gt; .disabled &gt; a:hover,
  .dropdown-menu &gt; .disabled &gt; a:focus {
    color: #777777;
  }
  .dropdown-menu &gt; .disabled &gt; a:hover,
  .dropdown-menu &gt; .disabled &gt; a:focus {
    text-decoration: none;
    background-color: transparent;
    background-image: none;
    filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
    cursor: not-allowed;
  }
  .open &gt; .dropdown-menu {
    display: block;
  }
  .open &gt; a {
    outline: 0;
  }
  </code></pre>
  
  <p>jquery</p>
  
  <pre><code>}(jQuery);
  ;(function($){
      'use strict';
    $(document).ready(function() {
      $('.toggle-sidebar').click(function() {
        $('.row-offcanvas').toggleClass('active');
      });
      $('.toggle-navigation').click(function() {
        $(this).toggleClass('open').next('#site-navigation').slideToggle(300);
      });
  
      $('#site-navigation .sub-menu, #site-navigation .children').before('&lt;i class="fa fa-caret-right"&gt;&lt;/i&gt;');
  
      if(!!('ontouchstart' in window)){
        $('#site-navigation .menu-item-has-children .fa, #site-navigation .page_item_has_children .fa')
        .click(function() {
          $(this).toggleClass('open').next('ul').slideToggle(300);
        });
      } else {
        $('#site-navigation .menu-item-has-children, #site-navigation .page_item_has_children')
        .not('.current-menu-parent, .current_page_parent, .current_page_ancestor, .current-menu-ancestor')
        .hover(function() {
          $(this).children('.fa').toggleClass('open').next('ul').stop(true, true).delay(200).slideDown();
        },function() {
          $(this).children('.fa').toggleClass('open').next('ul').stop(true, true).delay(500).slideUp();
        });
      }
    });
  })(jQuery);
  </code></pre>