如何在较小的屏幕上垂直向cssbootstrap附加菜单添加自动滚动条? [英] How to add auto scroll bar vertically to cssbootstrap affix menu for smaller screens?

查看:112
本文介绍了如何在较小的屏幕上垂直向cssbootstrap附加菜单添加自动滚动条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用css bootstrap 粘贴插件作为我网站上的粘滞菜单.

I am using css bootstrap affix plugin as a sticky menu on my site.

菜单上有很多项目,在台式机上这不是问题.但是,当我在小型笔记本电脑上查看网站时,菜单的下半部分会被截断.

I have lots of items on the menu which is not an issue on a desktop. However, when I view my site on a small laptop, the bottom half of my menu get cut off.

当屏幕较小时,我需要在菜单上添加一个自动滚动条.

I need to add an auto scroll bar to the menu when the screen is small.

这是我的html代码

<div class="container">
    <div class="row">

        <nav class="col-sm-3 scrollspy hidden-xs hidden-sm" id="docs-menu-column">

            <ul class="nav nav-pills nav-stacked scrollspy affix-menu" id="docs-menu" data-spy="affix">

                <li>
                  <strong>Code Generator</strong>
                  <ul class="nav">
                    <li><a href="#introduction">Introduction</a></li>
                    <li><a href="#features">Features</a></li>
                    <li><a href="#dependencies">Dependencies</a></li>
                  </ul>
                </li>

                <li>
                  <strong>Getting Started</strong>
                  <ul class="nav">
                    <li><a href="#installation">Installation</a></li>
                    <li><a href="#features">Features</a></li>
                    <li><a href="#available-commands">Available Command</a></li>
                  </ul>
                </li>

                <li>
                  <strong>How To</strong>
                  <ul class="nav">
                    <li><a href="#how-to-create-views-layout">How to create a "views-layout"</a></li>
                    <li><a href="#how-to-create-resource">How to create a resource</a></li>
                    <li><a href="#how-to-create-controller">How to create a controller</a></li>
                    <li><a href="#how-to-create-model">How to create a model</a></li>
                    <li><a href="#how-to-create-routes">How to create routes</a></li>
                    <li><a href="#how-to-create-views">How to create all standard CRUD views</a></li>
                    <li><a href="#how-to-create-create-view">How to create a "create-view"</a></li>
                    <li><a href="#how-to-create-edit-view">How to create a "edit-view"</a></li>
                    <li><a href="#how-to-create-index-view">How to create a "index-view"</a></li>
                    <li><a href="#how-to-create-show-view">How to create a "show-view"</a></li>
                    <li><a href="#how-to-create-form-view">How to create a "form-view"</a></li>
                    <li><a href="#how-to-create-migration">How to create a database migration</a></li>
                    <li><a href="#how-to-create-form-request">How to create form-request</a></li>
                    <li><a href="#how-to-create-language">How to create a language file</a></li>
                  </ul>
                </li>

                <li>
                  <strong>Fields</strong>
                  <ul class="nav">
                  <li><a href="#model-fields-overview">Overview</a></li>
                    <li><a href="#model-fields-json">Creating fields from JSON file</a></li>
                    <li><a href="#model-fields-raw">Creating fields from a raw string</a></li>
                  </ul>
                </li>

            </ul>

        </nav>


        <div class="col-md-9 large-padding-sections" id="docs-main-column">

            //Sections goes here.....
        </div>

    </div>
</div>

我尝试将style="overflow-y: auto !important;"添加到<nav class="col-sm-3 scrollspy hidden-xs hidden-sm" id="docs-menu-column",但这没有用.

I tried adding style="overflow-y: auto !important;" to the <nav class="col-sm-3 scrollspy hidden-xs hidden-sm" id="docs-menu-column" but that did not work.

如果屏幕的高度不足以显示整个词缀菜单,如何在左侧的nav垂直方向上正确添加滚动条?

How can I correctly add a scroll bar vertically to the nav on the left if the screen is not high enough to show the entire affix menu?

推荐答案

我认为问题是,即使您给它指令滚动,也没有限制高度的限制.试试这个:

I think the problem is that even though you're giving it directive to scroll, there's nothing limiting the height. Try this:

height: 100vh;
overflow-y: scroll;

这篇关于如何在较小的屏幕上垂直向cssbootstrap附加菜单添加自动滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆