gpt4 book ai didi

twitter-bootstrap - Bootstrap 3 和菜单

转载 作者:行者123 更新时间:2023-12-04 07:41:52 25 4
gpt4 key购买 nike

我想实现mmenu到 Bootstrap 3,但我被卡住了。我想要顶部导航,并且在折叠时我希望它更改为左侧滑动菜单。在此先感谢您的帮助。

编辑:我做了这个:https://github.com/purgeru/mmenu-Bootstrap-3 .如果有人想贡献。

最佳答案

这可以在没有 mmenu 的情况下完成,添加一点CSS。

我建议您创建 2 个不同的导航:

  • 一个 .navbar.navbar-fixed-top对于 -sm , -md-lg设备
  • 一个 .sidebar-offcanvas对于 -xs设备

  • See this Bootply 一个工作示例,基于 Offcanvas template .

    评论示例:
    <!-- Classic nav -->
    <div class="navbar navbar-fixed-top navbar-inverse" role="navigation">
    <div class="container">
    <div class="navbar-header">
    <!-- We change data-toggle to "offcanvas" -->
    <button type="button" class="navbar-toggle" data-toggle="offcanvas">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand" href="#">Project name</a>
    </div>
    <div class="collapse navbar-collapse">
    <ul class="nav navbar-nav">
    <li class="active"><a href="#">Home</a></li>
    <li><a href="#about">About</a></li>
    <li><a href="#contact">Contact</a></li>
    </ul>
    </div>
    </div>
    </div>

    <div class="container">

    <!-- You can use .row-offcanvas-left or .row-offcanvas-right -->
    <div class="row row-offcanvas row-offcanvas-left">

    <!-- Here is the offcanvas nav, with .visible-xs class -->
    <div class="col-xs-6 visible-xs sidebar-offcanvas" id="sidebar" role="navigation">
    <div class="list-group">
    <a href="#" class="list-group-item active">Home</a>
    <a href="#" class="list-group-item">About</a>
    <a href="#" class="list-group-item">Contact</a>
    </div>
    </div>

    <div class="col-12">
    Content
    </div>

    </div>

    </div>

    你需要一些 CSS :
    /*
    * Off Canvas
    * --------------------------------------------------
    */
    @media screen and (max-width: 767px) {
    .row-offcanvas {
    position: relative;
    -webkit-transition: all 0.25s ease-out;
    -moz-transition: all 0.25s ease-out;
    transition: all 0.25s ease-out;
    }

    .row-offcanvas-right .sidebar-offcanvas { right: -50%; }
    .row-offcanvas-right .sidebar-offcanvas .list-group { padding-right: 10px; }
    .row-offcanvas-right.active { right: 50%; }

    .row-offcanvas-left .sidebar-offcanvas { left: -50%; }
    .row-offcanvas-left .sidebar-offcanvas .list-group { padding-left: 10px; }
    .row-offcanvas-left.active { left: 50%; }

    .sidebar-offcanvas {
    position: absolute;
    top: 0;
    width: 50%; /* 6 columns */
    }
    }

    还有几行 JS :
    $(document).ready(function() {
    $('[data-toggle=offcanvas]').click(function() {
    $('.row-offcanvas').toggleClass('active');
    });
    });

    关于twitter-bootstrap - Bootstrap 3 和菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20280789/

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