案例:Foundation案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
  <title>Foundation 实例</title>
5
  <meta charset="utf-8">
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
  <link rel="stylesheet" href="/css/foundation5.5.3/foundation.min.css">
8
  <script src="/js/bootstrap/jquery.min.js"></script>
9
  <script src="/js/foundation5.5.3/foundation.min.js"></script>
10
  <script src="/js/foundation5.5.3/modernizr.js"></script>
11
</head>
12
<body style="height:1000px">
13
14
<div>
15
  <h1>导航栏绝对定位</h1> 
16
  <h3>滚动时固定导航栏。</h3>
17
  <p>我们可以将导航栏放在 <code>&lt;div class="sticky"&gt;</code> 内来设置导航栏的绝对定位,当滚动条滚到到该区域时,该导航栏就像固定导航栏一样在顶部不动:</p>
18
</div>
19
20
<div class="sticky">
21
  <nav class="top-bar" data-topbar>
22
    <ul class="title-area">
23
      <li class="name">
24
        <h1><a href="#">WebSiteName</a></h1>
25
      </li>
26
       <!-- 小屏幕上折叠按钮: 去掉 .menu-icon 类,可以去除图标。 
27
      如果需要只显示图片,可以删除 "Menu" 文本 -->
28
      <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
29
    </ul>
30
31
    <section class="top-bar-section">
32
      <ul class="left">
33
        <li class="active"><a href="#">Home</a></li>
34
        <li><a href="#">Page 1</a></li>
35
        <li><a href="#">Page 2</a></li>
36
        <li><a href="#">Page 3</a></li>    
37
      </ul>
38
    </section>
39
  </nav>
40
</div>
41
<h2>Some text to enable scrolling</h2>
42
<h2>Some text to enable scrolling</h2>
43
<h2>Some text to enable scrolling</h2>
44
<h2>Some text to enable scrolling</h2>
45
<h2>Some text to enable scrolling</h2>
46
<h2>Some text to enable scrolling</h2>
47
<h2>Some text to enable scrolling</h2>
48