jquery - Bootstrap, WordPress & NavWalker - Top Level Nav Links not working -



jquery - Bootstrap, WordPress & NavWalker - Top Level Nav Links not working -

i realize issue has been addressed in other postings, however, having problem top nav links not working on this site.

this wordpress site built on bootstrap 3 , using navwalker integrate wordpress navigation bootstrap structure. here navigation code:

<div class="navbar navbar-default col-md-9" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <?php wp_nav_menu( array( 'menu' => 'primary', 'theme_location' => 'primary', 'depth' => 2, 'container' => 'div', 'container_class' => 'collapse navbar-collapse col-md-9', 'container_id' => 'none', 'menu_class' => 'nav navbar-nav', 'fallback_cb' => 'wp_bootstrap_navwalker::fallback', 'walker' => new wp_bootstrap_navwalker()) ); ?> </div><!-- /.container --> </div><!-- /.navbar -->

this inherently lacks hover feature nice have on drop downwards menus. have addressed next solution wpeden:

( function( $ ) { jquery(function($) { $('.navbar .dropdown').hover(function() { $(this).find('.dropdown-menu').first().stop(true, true).delay(250).slidedown(); }, function() { $(this).find('.dropdown-menu').first().stop(true, true).delay(100).slideup(); }); $('.navbar .dropdown > a').click(function(){ location.href = this.href; }); }); } )( jquery );

this nice job of gracefully displaying drop downwards navigation, there no active links on parent menu items.

i have confirmed parent's have active links moving them out of navigation hierarchy no children display links correctly, there missing can't identify , appreciate keen eye or 2 help spot it.

navwalker seems designed that. need edit source code in wp_bootstrap_navwalker.php @ line #85.

make parent maintain href if has children

if ( $args->has_children && $depth === 0 ) { // $atts['href'] = '#'; // old line $atts['href'] = ! empty( $item->url ) ? $item->url : ''; // new line $atts['data-toggle'] = 'dropdown'; $atts['class'] = 'dropdown-toggle'; $atts['aria-haspopup'] = 'true'; } else { $atts['href'] = ! empty( $item->url ) ? $item->url : ''; }

jquery wordpress twitter-bootstrap-3 navigation

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -