我正在嘗試在Zurb fdn6模板的cli安裝中使用Magellan。該網頁運行良好,但麥哲倫只是不爲粘性導航工作,並拋出以下控制檯錯誤:
Uncaught TypeError: Cannot read property 'top' of undefined
Foundation 6 Magellan sticky不能與Zurb模板一起工作cli install
這樣看來麥哲倫註冊因爲DevTools查看源代碼時,我可以看到data-sticky
attr註冊一個值,當向上/向下滾動時,類將被應用於錨點。
但是,我注意到類不是註冊是:is-at-top is-stuck
這些似乎是什麼讓事情'棒'。它們出現在Zurb文檔示例中。
在app.js
我有$(document).foundation();
當頁面運行時,我可以看到Magellan模塊實際上正在加載。但粘性導航只是不堅持到窗口的頂部,它只是不能在這個設置。
<div data-sticky-container>
<div class="sticky" id="example" data-sticky data-margin-top="0" style="width:100%;" data-margin-bottom="0" data-top-anchor="topAnchorExample" data-btm-anchor="bottomOfContentId:bottom">
<nav data-magellan>
<ul class="horizontal menu expanded">
<li><a href="#first">First Arrival</a></li>
<li><a href="#second">Second Arrival</a></li>
<li><a href="#third">Third Arrival</a></li>
</ul>
</nav>
</div>
</div>
以下標準例如我已經看到其他SO實例固定的,但它們似乎都使用除Zurb tempate構建其他一般加載經由標準<script src="xyz">
呼叫的插件。
有人知道這個Zurb模板的例子嗎?
對不起,延遲迴復。我明白你的意思,但它仍然不適合我!我得到完全相同的結果 - 麥哲倫註冊,但沒有應用所需的類,使其堅持,我仍然得到相同的控制檯錯誤。只需重申,這是通過cli安裝在Zurb模板中,使用Handlebars/Panini結構。我已經在'./src/page/index.html'和'。/ src/pages/index.html'中試過了,但都沒有成功。 – redplanet