Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Twitter Bootstrap's JavaScript Lib contains something similar called <strong>"Affix"</strong>.</p> <p>It sticks the nav element to the window top and changes the current button to the current content. The same principle is used for the Vogue Date Sticky.</p> <p><strong>Have a look at it here:</strong><br> <a href="http://getbootstrap.com/javascript/#affix" rel="nofollow">http://getbootstrap.com/javascript/#affix</a></p> <p><strong>And also check out the source on GitHub:</strong><br> <a href="https://github.com/twbs/bootstrap/blob/3.0.0-wip/js/affix.js" rel="nofollow">https://github.com/twbs/bootstrap/blob/3.0.0-wip/js/affix.js</a></p> <p>&nbsp;<br> Looking at the source of the Vogue Site, all that is used is:</p> <pre><code>&lt;h2 data-bind="html: GroupName" class="fixed" style="top: 50px; width: 1077px;"&gt;Thursday 1&lt;sup&gt;st&lt;/sup&gt; August&lt;/h2&gt; </code></pre> <p>&hellip;together with some JS (located <a href="http://d3u12z27ui3vom.cloudfront.net/Build-Vogue-master/1947-879c27ae7cca/logic/article-listing-2012.generated.js" rel="nofollow">here</a>) which grabs the h2 headers and fixes them to the top "onscroll" at that pixel radius.</p> <p>&nbsp;<br> <strong>So, for example:</strong></p> <p>At the beginning the h2 looks like this:</p> <pre><code>&lt;h2 data-bind="html: GroupName"&gt;Thursday 1&lt;sup&gt;st&lt;/sup&gt; August&lt;/h2&gt; </code></pre> <p>When the user scrolls over it, then the h2 tag will be converted into:</p> <pre><code>&lt;h2 data-bind="html: GroupName" class="fixed" style="top: 50px; width: 1077px;"&gt;Thursday 1&lt;sup&gt;st&lt;/sup&gt; August&lt;/h2&gt; </code></pre> <p><em><strong>Notice</em></strong> that <code>class="fixed"</code> and the <code>style="..."</code> attributes got added. The h2 tag that got fixed prior to this one will be reset. jQuery is good at this if done right with careful use of the selectors (e.g. <code>var h2_elements = $('h2'); $('.fixed', h2_elements).removeClass('fixed');</code> or use something like <code>toggleClass('fixed')</code>). </p> <p><strong>That's it :-)</strong></p> <p>&nbsp;<br> Happy coding.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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