ampproject / ampproject/amphtml
Adding an "Offset" value to the "scrollTo" element
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Describe the new feature or change to an existing feature you'd like to see
**A clear and concise description of what you want to happen.**
If a website has a fixed header of let's say 300px, and the user clicks on a scrollTo link, the header will cover up the first part of the content. Using the "scrollTo" element is great, however the only position values are "top", "middle" and "bottom". It would be very useful if there was also an "offset" value. This would create a simple way of fixing this issue.
## Describe alternatives you've considered
**Provide a clear and concise description of any alternative solutions or features you've considered.**
Solution: Making a div element a set height above your scroll to div.
This solution takes time and is repetitive (you would need to do this for each scrollTo section).
Contributor guide
Research direction
Start by locating the AMP scrollTo element implementation and its existing handling of the top, middle, and bottom position values. Review related tests if present, then define how an offset value should be represented and verified so fixed headers no longer cover the target content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100