【问题标题】:Create fixed navbar adn fixed scrolled sidebar in adminLTE integration with yii2在 adminLTE 与 yii2 集成中创建固定导航栏和固定滚动侧边栏
【发布时间】:2016-10-14 13:24:31
【问题描述】:

我通过git, dmstr 使用 yii 和 adminLTE。

所以,我将布局从示例视图的文件夹复制到我的视图/布局 我的问题是

  1. 如何让导航栏固定
  2. 侧边栏是固定的,但可以滚动?

这是我的代码:

导航栏

<?php

use yii\helpers\Html;

/* @var $this \yii\web\View */
/* @var $content string */
?>

<header class="main-header">

<?= Html::a('<span class="logo-mini">TMS</span><span class="logo-lg">' . Yii::$app->name . '</span>', Yii::$app->homeUrl, ['class' => 'logo']) ?>

<nav class="navbar navbar-static-top" role="navigation">
    //Some element
</nav> 
</header>

侧边栏

<aside class="main-sidebar">
    <section class="sidebar">
    <!-- Sidebar user panel -->
    <div class="user-panel">
        <div class="pull-left image">
            <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle" alt="User Image"/>
        </div>
        <div class="pull-left info">
            <p>Dzil Jalal</p>

            <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
        </div>
    </div>

    <!-- search form -->
    <form action="#" method="get" class="sidebar-form">
        <div class="input-group">
            <input type="text" name="q" class="form-control" placeholder="Search..."/>
            <span class="input-group-btn">
                <button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i>
                </button>
            </span>
        </div>
    </form>
    <!-- /.search form -->

    <?=
    dmstr\widgets\Menu::widget(
            [
                'options' => ['class' => 'sidebar-menu'],
                'items' => [
                    ['label' => 'Menu Yii2', 'options' => ['class' => 'header']],
                    ['label' => 'Gii', 'icon' => 'fa fa-file-code-o', 'url' => ['/gii']],
                    ['label' => 'Debug', 'icon' => 'fa fa-dashboard', 'url' => ['/debug']],
                    ['label' => 'Login', 'url' => ['site/login'], 'visible' => Yii::$app->user->isGuest],
                    [
                        'label' => 'Same tools',
                        'icon' => 'fa fa-share',
                        'url' => '#',
                        'items' => [
                            ['label' => 'Gii', 'icon' => 'fa fa-file-code-o', 'url' => ['/gii'],],
                            ['label' => 'Debug', 'icon' => 'fa fa-dashboard', 'url' => ['/debug'],],
                            [
                                'label' => 'Level One',
                                'icon' => 'fa fa-circle-o',
                                'url' => '#',
                                'items' => [
                                    ['label' => 'Level Two', 'icon' => 'fa fa-circle-o', 'url' => '#',],
                                    [
                                        'label' => 'Level Two',
                                        'icon' => 'fa fa-circle-o',
                                        'url' => '#',
                                        'items' => [
                                            ['label' => 'Level Three', 'icon' => 'fa fa-circle-o', 'url' => '#',],
                                            ['label' => 'Level Three', 'icon' => 'fa fa-circle-o', 'url' => '#',],
                                        ],
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ]
    )
    ?>

    </section>

</aside>

感谢您的帮助

【问题讨论】:

    标签: css twitter-bootstrap yii


    【解决方案1】:

    要固定导航栏,放

    class="navbar navbar-fixed-top"

    而不是

    class="navbar navbar-static-top"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-23
      • 2018-09-13
      • 1970-01-01
      • 1970-01-01
      • 2018-06-25
      • 2014-12-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多