HTML – 如何使Foundation 5离开画布的导航菜单变粘?

前端之家收集整理的这篇文章主要介绍了HTML – 如何使Foundation 5离开画布的导航菜单变粘?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用最新版本的Foundation来添加一个非画布导航菜单,并在标签栏中添加一个切换.虽然我使用Tab键栏是粘性的,但非画布菜单内容页面滚动.如何使菜单内容变得粘稠,以便在任何尺寸的屏幕或页面上垂直滚动位置按菜单切换将显示菜单内容而不滚动?到目前为止我的 HTML是:
<!doctype html>
<html class="no-js" lang="en">
<head>
    <Meta charset="utf-8" />
    <Meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <title>Foundation | Welcome</title>
    <link rel="stylesheet" href="css/foundation.css" />
    <script src="js/vendor/modernizr.js"></script>
</head>
<body>
    <div class="off-canvas-wrap" data-offcanvas>
        <div class="contain-to-grid sticky">
            <nav class="tab-bar top-bar" data-topbar data-options="sticky_on: large">
                <section class="left-small">
                    <a class="left-off-canvas-toggle menu-icon" href="#"><span></span></a>
                </section>

                <section class="middle tab-bar-section">
                    <h1 class="title">Foundation</h1>
                </section>
            </nav>
        </div>

        <div class="inner-wrap">

            <!-- Off Canvas Menu -->
            <aside class="left-off-canvas-menu">
                <!-- whatever you want goes here -->
                <ul>
                    <li><a href="#">Item 1</a></li>
                    <li><a href="#">Item 2</a></li>
                    <li><a href="#">Item 3</a></li>
                    <li><a href="#">Item 4</a></li>
                    <li><a href="#">Item 5</a></li>
                </ul>
            </aside>

            <div class="row">
                <div class="large-12 columns">
                    <h1>Welcome to Foundation</h1>
                </div>
            </div>

            <!-- Content goes here -->

            <!-- close the off-canvas menu -->
            <a class="exit-off-canvas"></a>

        </div>
    </div>

    <script src="js/vendor/jquery.js"></script>
    <script src="js/foundation.min.js"></script>
    <script>
        $(document).foundation();
    </script>
</body>
</html>

解决方法

使内容的高度为95vh,溢出-y =滚动.每当滚动右侧的内容时,非画布菜单不受影响并保持在顶部.

CSS:

.mycontent {     
  height:95vh;
  overflow-y:scroll;
  /* fix scrolling on webkit touch devices (iPhone etc) */
  -webkit-overflow-scrolling: touch; 
}

HTML:

<div class="row mycontent" >
      <div class="large-12 columns">
          <h1>Welcome to Foundation</h1>
      </div>
  </div>
原文链接:https://www.f2er.com/html/225617.html

猜你在找的HTML相关文章