I'M using a custom wordpress menu as a sidebar element (Sidebar made in visual composer lay-out).
Now the problem is that the complete box is a trigger for opening the dropdown menu, This means the main item link can never be activated.
I would love to make only the arrow a trigger for the submenu to open, but can't find any way as the arrow and menu item text are in the same 'ahref'.
This forces me to duplicate menu items in my menu.
Markup created by wordpress
<li id="menu-item-333" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-325 current_page_item menu-item-333"><a href="http://www.site.nl/link/" target="_blank">Dorp</a></li>
The down arrow is added using an "after:" css statement.
#PB .widget_nav_menu .menu-item-has-children a:after {
content: "\f107";
font-family: FontAwesome;
}
Code i THINK is asociated with it
/**
* Custom menu widget toggles
*
* @since 2.0.0
*/
customMenuWidgetAccordion: function() {
var self = this;
// Open toggle for active page
$( '.widget_nav_menu .current-menu-ancestor', self.config.$siteMain ).addClass( 'active' ).children( 'ul' ).show();
// Toggle items
$( '.widget_nav_menu', self.config.$siteMain ).each( function() {
var $hasChildren = $( this ).find( '.menu-item-has-children' );
$hasChildren.each( function() {
$( this ).addClass( 'parent' );
var $links = $( this ).children( 'a' );
$links.on( 'click', function( event ) {
var $linkParent = $( this ).parent( 'li' );
var $allParents = $linkParent.parents( 'li' );
if ( ! $linkParent.hasClass( 'active' ) ) {
$hasChildren.not( $allParents ).removeClass( 'active' ).children( '.sub-menu' ).slideUp( 'fast' );
$linkParent.addClass( 'active' ).children( '.sub-menu' ).stop( true, true ).slideDown( 'fast' );
} else {
$linkParent.removeClass( 'active' ).children( '.sub-menu' ).stop( true, true ).slideUp( 'fast' );
}
return false;
} );
} );
} );
},
In a nutshell: how can i make only the icon clickable for activating the dropdown menu and make the rest of the button send me to the correct page.