您好,我需要您的专业知识,因为它在桌面模式下可以完美运行,但是如果它的移动模式在单击下拉菜单后无法正常运行,则会自动关闭整个导航栏,
<li class="dropdown">
<a data-toggle="dropdown" > Shop </a>
<ul class="dropdown-menu">
<li><a href="<?php echo home_url(); ?>/shop">All Inventory</a></li>
<li><a href="<?php echo home_url(); ?>/product-category/designer-bags">Designer Bags</a></li>
<li><a href="<?php echo home_url(); ?>/product-category/designer-accessories">Designer Accessories</a></li>
<li><a href="<?php echo home_url(); ?>/outright-buying/">Outright Buying</a></li>
<li><a href="<?php echo home_url(); ?>/Consignment">Consignment</a></li>
</ul>
</li>
答案 0 :(得分:0)
在navbar-toggle
上单击时,以下代码展开子菜单
然后根据子菜单的打开/关闭状态将aria-expanded
更改为正确的值
function opensubmenus() {
if ($(window).width() < 768) {
$("#top-navbar-collapse li").addClass('open');
$("#top-navbar-collapse li a").attr('aria-expanded','true');
}else{
$("#top-navbar-collapse li").removeClass('open');
$("#top-navbar-collapse li a").attr('aria-expanded','false');
}
}
$('#top-menu .navbar-toggle').click(function(){
setTimeout(opensubmenus, 100);
});
$(window).resize(opensubmenus);
opensubmenus();