在菜单展开时修复内容滚动

时间:2014-12-29 17:58:57

标签: html css menu

我试图让移动菜单可滚动,同时在打开时将页面内容保持在固定点。你会注意到通过页面底部滚动菜单的不受欢迎的可见性

JS FIDDLE

    <div class="navigation mobile">
        <div class="menu-wrap">

            <div class="project-tile">
                <div class="copy">
                    <h2><a href="#">Title</a></h2>
                    <a href="#">View project</a>
                </div><!-- /copy -->
            </div><!-- /project-tile -->

            <div class="project-tile">
                <div class="copy">
                    <h2><a href="#">Title</a></h2>
                    <a href="#">View project</a>
                </div><!-- /copy -->
            </div><!-- /project-tile -->

        </div><!-- /menu-wrap -->
    </div><!-- /navigation -->

    <input type="checkbox" id="nav-trigger" class="nav-trigger mobile" />
    <label class="mobile" for="nav-trigger">Menu</label>


<div id="content" class="site-wrap">
Copy</div>

</div>

1 个答案:

答案 0 :(得分:1)

尝试更改导航元素的位置并添加溢出滚动,如此

.navigation
{
   position: fixed;
   overflow-y: scroll;
}

http://jsfiddle.net/x64c1L83/3/