sul-cidr / noh

Noh as Intermedia
http://noh.stanford.edu/
MIT License
4 stars 2 forks source link

Make secondary navbar behave when scrolling and jumping on L0 #575

Closed broadwell closed 4 years ago

broadwell commented 4 years ago

This fixes #572 (the secondary "sticky" navbar slides in or out unwelcomely during manual or anchor-driven up-scrolls, respectively, on L0 pages) through the rather brutish expedient of setting a global variable when any in-page anchor link is clicked; the scroll handling code checks this variable before displaying the navbar (or not). This replaces the heuristic of only hiding the navbar on upward scrolls of >100 pixels, which had proved problematic.

This also suppresses unwanted appearances of the navbar on the catalog pages (/movement/ and /catalog-of-shodan/).

Note that the previous code in tabs.js for detecting when an in-page anchor link is being clicked didn't work properly.

simonwiles commented 4 years ago

Okay, yes, I can reproduce the "buggy" behaviour here (but only with a touch pad -- it seems I can't mouse-wheel fast enough, despite trying with two hands!), and confirm that these commits eliminate it, thanks. I don't love the implementation (any more than you seem to :) ), but it does the job robustly, and I'm happy to approve.