我的导航工作得很好,当我今天早上尝试时,有孩子的父导航不会像以前那样在悬停时下降,而且父导航链接也停止工作?诡异的。我在 class-wp-bootstrap-navwalker.php 中检查了我的代码,一切都一样吗?
if ( isset( $args->has_children ) && $args->has_children && 0 === $depth && $args->depth > 1 ) {
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
$atts['data-toggle'] = 'dropdown';
$atts['aria-haspopup'] = 'true';
$atts['aria-expanded'] = 'false';
$atts['class'] = 'dropdown-toggle nav-link';
$atts['id'] = 'menu-item-dropdown-' . $item->ID;
} else {
$atts['href'] = ! empty( $item->url ) ? $item->url : '#';
JS:
$('.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;
});`
我不知道发生了什么,或者我可以做些什么来解决您将鼠标悬停在有孩子的项目上的位置,它应该触发下拉菜单。任何帮助将不胜感激。谢谢你。
