gpt4 book ai didi

jquery - 单击时隐藏 Twitter Bootstrap 导航折叠

转载 作者:IT王子 更新时间:2023-10-29 03:24:28 25 4
gpt4 key购买 nike

这不是子菜单下拉菜单,类别是图片中的 li 类:

enter image description here

By selecting a category from the responsive menu (the template is justone page), I want to hide nav collapse automatically when clicking.Also stroll to use as navigation, since the template has only onepage. I seek a solution that does not affect it, here is the HTML codeof menu:

    <!-- NAVBAR
================================================== -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#">Carousel Demo</a>
<div class="nav-collapse">
<ul class="nav" >
<li class="active"><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#contact">Contact</a></li>
<!-- dropdown -->
</ul>
<!-- /.nav -->
</div>
<!--/.nav-collapse -->
</div>
<!-- /.container -->
</div>
<!-- /.navbar-inner -->
</div>
<!-- /.navbar -->

最佳答案

试试这个:

$('.nav a').on('click', function(){
$('.btn-navbar').click(); //bootstrap 2.x
$('.navbar-toggle').click(); //bootstrap 3.x by Richard
$('.navbar-toggler').click(); //bootstrap 4.x
});

关于jquery - 单击时隐藏 Twitter Bootstrap 导航折叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16680543/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com