I'm trying to use Magellan in a cli install of the Zurb fdn6 template. The page is running fine but Magellan just doesn't work for the sticky nav and throws the following console error:
Uncaught TypeError: Cannot read property 'top' of undefined
It would appear Magellan is registering because when viewing the source in DevTools I can see the data-sticky
attr registering a value, and active
class is being applied to the anchors when scrolling up/down.
However, I do notice classes that aren't registering are: is-at-top is-stuck
and these appear to be what makes the thing 'stick'. They show up in the Zurb docs example.
In app.js
I have $(document).foundation();
and when the page runs I can see that the Magellan module is actually loading. But the sticky nav just isn't sticking to the top of the window, it just doesn't work in this setup.
I've used the following standard example from Zurb Fdn Magellan docs:
<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>
I've seen other SO examples fixed but they all seemed to use builds other than the Zurb tempate and generally loaded the plugins via standard <script src="xyz">
calls.
Does anyone know what's up with this Zurb template example?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…