亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Foundation Magellan

Foundation 麥哲倫(Magellan)導(dǎo)航


如何創(chuàng)建麥哲倫導(dǎo)航

麥哲倫導(dǎo)航就是一個(gè)導(dǎo)航索引,創(chuàng)建方式如下:

實(shí)例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 實(shí)例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>
<body style="height:1500px;padding:20px;">

<h2>Magellan</h2>
<h4 class="subheader">麥哲倫導(dǎo)航就是一個(gè)導(dǎo)航索引,位置是固定的,會(huì)根據(jù)用戶滾動(dòng)當(dāng)前展示的內(nèi)容自動(dòng)切換導(dǎo)航欄上的導(dǎo)航項(xiàng):</h4>
<hr>

<div data-magellan-expedition="fixed">
  <dl class="sub-nav">
    <dd data-magellan-arrival="page1"><a href="#page1">Page 1</a></dd>
    <dd data-magellan-arrival="page2"><a href="#page2">Page 2</a></dd>
  </dl>
</div>
<hr>

<div style="height:200px;background-color:#1abc9c;color:white;">
  <h3 data-magellan-destination="page1">頁(yè)面 1</h3>
  <a name="page1"></a>
  <p>滾動(dòng)屏幕,查看導(dǎo)航欄上的變化。</p>
</div>

<h3 data-magellan-destination="page2">頁(yè)面 2</h3>
<a name="page2"></a>
<p>滾動(dòng)屏幕,查看導(dǎo)航欄上的變化。并嘗試向上滾動(dòng)。</p>

<!-- 初始化 Foundation JS -->
<script>
$(document).ready(function() {
    $(document).foundation();
})
</script>

</body>
</html>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例

實(shí)例解析

在 <div> 元素上添加 data-magellan-expedition="fixed" 屬性來(lái)創(chuàng)建麥哲倫導(dǎo)航。

然后在 <dd><li> 上添加  data-magellan-arrival="value" 屬性,后面添加一個(gè)與該屬性值一樣的鏈接(page1)。

使用 data-magellan-destination="value" 屬性來(lái)控制麥哲倫導(dǎo)航的目標(biāo), 后面緊跟的 <a> 元素添加 name="value" 屬性。兩個(gè)屬性的值必須與 data-magellan-arrival 的值一致 (page1)。

最后,初始化 Foundation JS ,用戶在滾動(dòng)頁(yè)面時(shí)導(dǎo)航就會(huì)根據(jù)當(dāng)前顯示的內(nèi)容自動(dòng)切換。


麥哲倫導(dǎo)航頭部工具條

麥哲倫導(dǎo)航使用頭部工具條實(shí)例:

實(shí)例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 實(shí)例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>
<body>

<div data-magellan-expedition="fixed">
<nav class="top-bar" data-topbar>
  <ul class="title-area">
    <li class="name">
      <h1><a href="#">WebSiteName</a></h1>
    </li>
    <!-- Collapsible Button on small screens: remove the .menu-icon class to get rid of icon. 
    Remove the "Menu" text if you only want to show the icon -->
    <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
  </ul>

  <section class="top-bar-section">
    <ul class="left">
      <li data-magellan-arrival="page1"><a href="#page1">Page 1</a></li>
      <li data-magellan-arrival="page2"><a href="#page2">Page 2</a></li>
    </ul>
  </section>
</nav>
</div>

<div style="padding:20px;height:1500px;">
  <h3>Magellan 頭部導(dǎo)航實(shí)例</h3>
  <p>向下滾動(dòng)頁(yè)面查看效果。</p>

<div style="height:200px;background-color:#1abc9c;color:white;">
  <h3 data-magellan-destination="page1">Page1</h3>
  <a name="page1"></a>
  <p>滾動(dòng)屏幕,查看導(dǎo)航欄上的變化。</p>
</div>

<h3 data-magellan-destination="page2">Page2</h3>
<a name="page2"></a>
<p>滾動(dòng)屏幕,查看導(dǎo)航欄上的變化。并嘗試向上滾動(dòng)。</p>
</div>

<!-- 初始化 Foundation JS -->
<script>
$(document).ready(function() {
    $(document).foundation();
})
</script>

</body>
</html>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例


麥哲倫導(dǎo)航內(nèi)邊距

默認(rèn)情況下,麥哲倫導(dǎo)航的 <div> 元素有 10px 的內(nèi)邊距。可以使用 CSS 移除它:

實(shí)例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 實(shí)例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>

 <style>
  [data-magellan-expedition], [data-magellan-expedition-clone] {
      padding: 0;
  }
  </style>
</head>
<body>

<div data-magellan-expedition="fixed">
<nav class="top-bar" data-topbar>
  <ul class="title-area">
    <li class="name">
      <h1><a href="#">WebSiteName</a></h1>
    </li>
    <!-- 小屏幕上折疊按鈕: 去掉 .menu-icon 類,可以去除圖標(biāo)。 
      如果需要只顯示圖片,可以刪除 "Menu" 文本 -->
    <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
  </ul>

  <section class="top-bar-section">
    <ul class="left">
      <li data-magellan-arrival="page1"><a href="#page1">Page 1</a></li>
      <li data-magellan-arrival="page2"><a href="#page2">Page 2</a></li>
    </ul>
  </section>
</nav>
</div>

<div style="padding:20px;height:1500px;">
  <h3>Magellan 頭部導(dǎo)航實(shí)例</h3>
  <p>向下滾動(dòng)頁(yè)面查看效果。</p>

<div style="height:200px;background-color:#1abc9c;color:white;">
  <h3 data-magellan-destination="page1">Page1</h3>
  <a name="page1"></a>
  <p>滾動(dòng)屏幕,查看導(dǎo)航欄上的變化。</p>
</div>

<h3 data-magellan-destination="page2">Page2</h3>
<a name="page2"></a>
<p>滾動(dòng)屏幕,查看導(dǎo)航欄上的變化。并嘗試向上滾動(dòng)。</p>
</div>

<!-- 初始化 Foundation JS -->
<script>
$(document).ready(function() {
    $(document).foundation();
})
</script>

</body>
</html>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例


麥哲倫導(dǎo)航選項(xiàng)

使用 data-options 屬性修改麥哲倫導(dǎo)航的設(shè)置, 例如 <div data-magellan-expedition="fixed" data-options="destination_threshold:60">:

名稱類型默認(rèn)描述實(shí)例
active_classstringactive指定激活鏈接的類嘗試一下
thresholdnumber0指定導(dǎo)航在什么時(shí)候需要固定位置。會(huì)根據(jù)滾動(dòng)條滾動(dòng)計(jì)算,默認(rèn)為 0 (auto)。嘗試一下
destination_thresholdnumber20設(shè)該值設(shè)定了導(dǎo)航鏈接顯示為激活(藍(lán)色背景)時(shí)導(dǎo)航列表距離頂部的值。嘗試一下
fixed_topnumber0指定了導(dǎo)航條距離頭部的像素值嘗試一下