Bootstrap Navigation mobile - wordpress

时间:2016-11-24 10:33:51

标签: html css wordpress twitter-bootstrap

在调整浏览器的移动响应菜单时,我遇到了导航工作的问题。我尝试过尽可能多的事情。 Bellow是我导航的代码,链接是http://proof.waxedmedia.co.za/gavinerwin/ 请你帮我看看它是否正确!

<div class="navbar-header container-fluid">
            <div class="container">
                <div class="row">
                    <div class="col-xs-4 col-sm-6 col-md-4 col-lg-4">
                        <a href="/"><img src="<?php bloginfo('template_url'); ?>/images/Gav_Sig1.png" alt="signature" class="img-responsive"></a>
                    </div>
                    <div class=" col-xs-6 col-sm-offset-0 col-sm-6 col-md-offset-2 col-md-6 col-lg-offset-2 col-lg-6 ">
                        <nav class="navbar navbar-default" role="navigation">
                            <div class="row main-nav">
                                <!-- Toggle get grouped for better mobile display -->
                                <div class="navbar-header">
                                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-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>

<!-- Collect the nav links for toggling -->
                                <div class="collapse navbar-collapse navbar-ex1-collapse">
                                    <?php
                                    wp_nav_menu(array(
                                        'menu' => 'Main Nav Menu',
                                        'depth' => 2,
                                        'theme_location' => 'primary',
                                        'container_class' => 'collapse navbar-collapse',
                                        'container' => false,
                                        'menu_class' => 'menu',
                                        'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
                                        'walker' => new wp_bootstrap_navwalker(),
                                    ));
                                    ?>
                                </div>
                            </div>
                        </nav>
                    </div>
                </div>
            </div>
        </div>

1 个答案:

答案 0 :(得分:0)

CSS:

@media (max-width: 767px){
.row ul, .row ul li, .row ul li a {
    padding: 5px 0;
    font-size: 1.14em;
    display: block;
}
}

HTML:您在.col-xs-4中获得了.col-xs-6row。我已将.col-xs-6更改为col-xs-8,以便更好地放置汉堡菜单图标。

<div class="navbar-header container-fluid">
  <div class="container">
    <div class="row">
      <div class="col-xs-4 col-sm-6 col-md-4 col-lg-4">
        <a href="/"><img src="http://proof.waxedmedia.co.za/gavinerwin/wp-content/themes/gavinerwin/images/Gav_Sig1.png" alt="signature" class="img-responsive"></a>
      </div>
      <div class=" col-xs-8 col-sm-offset-0 col-sm-6 col-md-offset-2 col-md-6 col-lg-offset-2 col-lg-6 ">
        -------
        ------
      </div>
    </div>
  </div>

我希望这会有所帮助。