Note that there are some explanatory texts on larger screens.

plurals
  1. POStick a div when using Foundation
    text
    copied!<p>I want to stick a div on top when scrolling the window.</p> <p>Looks like Magellan of Foundation provides similar behavior. But I want to stick my custom elements(the div with attribute <strong><em>data-magellan-expedition="fixed"</em></strong>) on top instead of Sub-Nav in <a href="http://foundation.zurb.com/docs/components/magellan.html" rel="nofollow">Magellan's example</a>.</p> <pre><code>&lt;body&gt; &lt;!-- Header and Nav --&gt; &lt;nav id="nav" class="top-bar"&gt; &lt;ul class="title-area"&gt; &lt;!-- Title Area --&gt; &lt;li class="name"&gt; &lt;h1&gt; &lt;a href="#"&gt; Foundation Magellan &lt;/a&gt; &lt;/h1&gt; &lt;/li&gt; &lt;li class="toggle-topbar menu-icon"&gt;&lt;a href="#"&gt;&lt;span&gt;Sitemap&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;section class="top-bar-section"&gt; &lt;!-- Left Nav Section --&gt; &lt;ul class="left"&gt; &lt;li class="divider"&gt;&lt;/li&gt; &lt;li class="active" &gt;&lt;a href="#"&gt;Item1&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;!-- Right Nav Section --&gt; &lt;ul class="right"&gt; &lt;li class="divider"&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Login&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/section&gt; &lt;/nav&gt; &lt;!-- End Header and Nav --&gt; &lt;!-- Main Feed --&gt; &lt;div data-magellan-expedition="fixed" &gt; &lt;div id="calendar" class="row"&gt; &lt;dl id="calendar-per-day" class="sub-nav"&gt; &lt;script&gt; someCodeToCreateCalendar(); &lt;/script&gt; &lt;/dl&gt; &lt;hr&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="large-12 columns"&gt; &lt;div id="baidumap" style="height:300px; overflow: hidden; margin: 0;"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="large-9 columns"&gt; &lt;p&gt; very long content can be scrolled............ &lt;/p&gt; &lt;/div&gt; &lt;div class="large-3 columns"&gt; &lt;div class="row"&gt; &lt;div class="large-11 large-centered columns"&gt; &lt;h4&gt;Right side content&lt;/h4&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Footer --&gt; &lt;footer id="footer" class="row"&gt; &lt;div class="large-12 columns"&gt; &lt;hr /&gt; &lt;div class="row"&gt; &lt;div class="large-5 columns"&gt; &lt;p&gt;&amp;copy; 2013 All Rights Reserved&lt;/p&gt; &lt;/div&gt; &lt;div class="large-7 columns"&gt; &lt;ul class="inline-list right"&gt; &lt;li&gt;&lt;a href="#"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/footer&gt; &lt;script src="http://cdnjs.cloudflare.com/ajax/libs/foundation/5.0.2/js/foundation/foundation.min.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).foundation(); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>There is <a href="https://gist.github.com/zxkane/7838623" rel="nofollow">full my code</a> to try my thought. I want the calendar and map always stick on top when scrolling the window. But it does not work at all. Does anybody know how to do it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload