This repository has been archived by the owner on Mar 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Highlight anchors in the page contents navigation, on scroll #61
Merged
Commits on Oct 25, 2016
-
Include javascript for the sticky page contents
This already exists within the frontend toolkit, use both stick at top when scrolling (to set the page contents to position:fixed) and stop scrolling at footer, to return the page contents to position: static when the top of the footer reaches the bottom of the page contents.
Configuration menu - View commit details
-
Copy full SHA for e6eedf6 - Browse repository at this point
Copy the full SHA e6eedf6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0adf211 - Browse repository at this point
Copy the full SHA 0adf211View commit details -
Add js hooks for StickAtTopWhenScrolling and HighlightActiveSection
The navigation highlight module uses this hook for the in-page navigation (js-page-contents). Also add a js hook to the page contents area This is required to get the stick-at-top-when-scrolling js to work. Stick at top when scrolling also has a futher optional hook to set the sticky element and the shim to resize to fit the parent (the hook for this is js-sticky-resize).
Configuration menu - View commit details
-
Copy full SHA for f1a83a8 - Browse repository at this point
Copy the full SHA f1a83a8View commit details
Commits on Oct 26, 2016
-
Include styles required by the stick at top when scrolling js
These are required by GOVUK.stickAtTopWhenScrolling. Add extra padding on to the bottom of the page contents list, so that it doesn’t allow the Is there anything wrong with this page? link to overlap the bottom of the page contents list.
Configuration menu - View commit details
-
Copy full SHA for cd515b0 - Browse repository at this point
Copy the full SHA cd515b0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 241dace - Browse repository at this point
Copy the full SHA 241daceView commit details -
Add a new module - highlight active section heading
When the page is scrolled, this will highlight an item in the left hand page contents.
Configuration menu - View commit details
-
Copy full SHA for 367b8b6 - Browse repository at this point
Copy the full SHA 367b8b6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 56a0d0e - Browse repository at this point
Copy the full SHA 56a0d0eView commit details -
- it has no highlighted nav items, when the page loads - it highlights a nav item, when the page is scrolled Mock the values for scroll position and heading position, and also footer position to ensure the last item is highlighted.
Configuration menu - View commit details
-
Copy full SHA for 56f7080 - Browse repository at this point
Copy the full SHA 56f7080View commit details -
Handle cases where the headings do not appear on the page
The body of a guide is rendered using a shared ‘GovSpeak’ component. In test mode shared components are not fetched from Static. Instead they are rendered as a dummy tag which contains a JSON dump of the locals - the arguments passed to the component. This means that the headings we expect to be present on the page (within the body of the guide) are not present. This which was causing JavaScript errors on the page, which were appearing in unrelated tests that used the Javascript driver to execute. By returning early if we cannot get the offset of a heading we guard against this.
Configuration menu - View commit details
-
Copy full SHA for cff0bdd - Browse repository at this point
Copy the full SHA cff0bddView commit details -
Adjust margins for govspeak content
This is so that when a page contents anchor is clicked on, the title “Page contents” and the title of the section will line up - rather than the title of the section sitting at the very top of the page.
Configuration menu - View commit details
-
Copy full SHA for df4b873 - Browse repository at this point
Copy the full SHA df4b873View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.