Slide down and slide up all tears of wordpress menu items on click function:
<script>
jQuery('.sub-menu').hide();
jQuery(document).ready(function($){
jQuery('li.menu-item-has-children a').on("click", function(e){
e.stopPropagation();
e.preventDefault();
if(!$(this).closest('li').hasClass('menu-item-has-children')){
window.location.href = $(this).attr('href');
}
jQuery(this).next('.sub-menu').slideToggle();
});
});
</script>