# Foundation 麥哲倫(Magellan)導航

## 如何創建麥哲倫導航
麥哲倫導航就是一個導航索引,創建方式如下:
### 實例
```
<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>
<h3 data-magellan-destination="page1">Page1</h3>
<a name="page1"></a>
...
<h3 data-magellan-destination="page2">Page2</h3>
<a name="page2"></a>
...
<!-- Initialize Foundation JS -->
<script>
$(document).ready(function() {
??? $(document).foundation();
})
</script>
```
### 實例解析
在 <div> 元素上添加 `data-magellan-expedition="fixed"` 屬性來創建麥哲倫導航。
然后在 `<dd>` 或 `<li>` 上添加 `data-magellan-arrival="_value_"` 屬性,后面添加一個與該屬性值一樣的鏈接(page1)。
使用 `data-magellan-destination="value"` 屬性來控制麥哲倫導航的目標, 后面緊跟的 `<a>` 元素添加 `name="_value_"` 屬性。兩個屬性的值必須與 `data-magellan-arrival` 的值一致 (**page1**)。
最后,初始化 Foundation JS ,用戶在滾動頁面時導航就會根據當前顯示的內容自動切換。
## 麥哲倫導航頭部工具條
麥哲倫導航使用頭部工具條實例:
### 實例
```
<div data-magellan-expedition="fixed">
? <nav class="top-bar" data-topbar>
??? ...
??? <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>
<h3 data-magellan-destination="page1">Page1</h3>
<a name="page1"></a>
...
<h3 data-magellan-destination="page2">Page2</h3>
<a name="page2"></a>
...
```
## 麥哲倫導航內邊距
默認情況下,麥哲倫導航的 `<div>` 元素有 10px 的內邊距。可以使用 CSS 移除它:
### 實例
```
[data-magellan-expedition], [data-magellan-expedition-clone] {
??? padding: 0;
}
```
## 麥哲倫導航選項
使用 data-options 屬性修改麥哲倫導航的設置, 例如 `<div data-magellan-expedition="fixed" data-options="destination_threshold:60">`:
| 名稱 | 類型 | 默認 | 描述 | 實例 |
| --- | --- | --- | --- | --- |
| active_class | string | active | 指定激活鏈接的類 |
| threshold | number | 0 | 指定導航在什么時候需要固定位置。會根據滾動條滾動計算,默認為 0 (auto)。 |
| destination_threshold | number | 20 | 設該值設定了導航鏈接顯示為激活(藍色背景)時導航列表距離頂部的值。 |
| fixed_top | number | 0 | 指定了導航條距離頭部的像素值 |
- Foundation 入門
- Foundation 5 簡介
- Foundation 起步
- Foundation 文本
- Foundation 表格
- Foundation 按鈕
- Foundation 按鈕組
- Foundation 圖標
- Foundation 標簽
- Foundation 提醒框
- Foundation 進度條
- Foundation 面板
- Foundation 圖片
- Foundation 下拉菜單
- Foundation 折疊列表
- Foundation 列表
- Foundation 選項卡
- Foundation 分頁
- Foundation 價格表
- Foundation 頂部導航欄
- Foundation 側邊欄
- Foundation 滑動導航(Off-Canvas)
- Foundation 麥哲倫(Magellan)導航
- Foundation 表單
- Foundation 輸入框尺寸
- Foundation 開關
- Foundation 滑塊
- Foundation 提示框
- Foundation 模態框
- Foundation Joyride
- Foundation 均衡器(Equalizer)
- Foundation 網格
- Foundation 網格系統
- Foundation 網格 - 水平堆疊
- Foundation 網格 - 小型設備
- Foundation 網格 - 中型設備
- Foundation 網格 - 大型設備
- Foundation 塊狀網格
- Foundation 網格實例
- Foundation 參考手冊
- Foundation 圖標參考手冊
- Foundation CSS 參考手冊
- Foundation CSS 可見性