Note that there are some explanatory texts on larger screens.

plurals
  1. POWaypoints - Sticky Header Navigation. Links Are Highlighted Upon Scrolling Down But Not Scrolling Up
    primarykey
    data
    text
    <p>I have a site template that I am working on that can be seen here:</p> <p><a href="http://www.procardetail.co.uk/" rel="nofollow">http://www.procardetail.co.uk/</a></p> <p>As you can see I have Waypoints in action with a sticky header.</p> <p>Everything works fine when I am scrolling down the page and the navigation links highlight as expected as they encounter the anchors on the page.</p> <p>However when scrolling up, the functionality of highlighting the links does not work.</p> <p>The javascript I am using looks like this:</p> <pre><code>$(function() { // Do our DOM lookups beforehand var nav_container = $("#navs"); var nav = $("nav"); var top_spacing = 15; var waypoint_offset = 50; nav_container.waypoint({ handler: function(event, direction) { if (direction == 'down') { nav_container.css({ 'height':nav.outerHeight() }); nav.stop().addClass("sticky").css("top",-nav.outerHeight()).animate({"top":top_spacing}); } else { nav_container.css({ 'height':'auto' }); nav.stop().removeClass("sticky").css("top",nav.outerHeight()+waypoint_offset).animate({"top":""}); } }, offset: function() { return -nav.outerHeight()-waypoint_offset; } }); var sections = $("section"); var navigation_links = $("nav a"); sections.waypoint({ handler: function(event, direction) { var active_section; active_section = $(this); if (direction === "up") active_section = active_section.prev(); var active_link = $('nav a[href="#' + active_section.attr("id") + '"]'); navigation_links.removeClass("selected"); active_link.addClass("selected"); }, offset: '25%' }) navigation_links.click( function(event) { $.scrollTo( $(this).attr("href"), { duration: 100, offset: { 'left':0, 'top':-0.15*$(window).height() } } ); }); </code></pre> <p>});</p> <p>Is anyone able to shed some light on why this is happening?</p> <p>Thanks for your time and help in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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