Closed erikyo closed 1 year ago
@erikyo Thank you for the issue, I like the idea!
I think providing a (user-facing) option for this is too specific, at least for now I would prefer to limit defining this to a simple API. Maybe just a fast_smooth_scroll_offset
filter for now?
Yes a filter would be more than enough to create the necessary shift in certain layouts. Furthermore I find the filter idea interesting because, being a filter, it is possible to activate it conditionally
Description: I would like to request a new feature for this project that would enhance user experience when navigating a page with a fixed header. Currently, when using anchors to navigate to specific sections on a webpage, the anchor scrolls to the exact top of the target element. However, when a site has a fixed header, this behavior can lead to the target content being obscured by the header, which is not aesthetically pleasing.
Proposed Feature: My suggestion is to introduce an "offset" option for scrolling when using anchors. This offset would allow users to specify how much space should be left between the top of the target element and the top of the viewport when scrolling to the anchor. This would ensure that the content is visible and not hidden by a fixed header.
Example: For instance, if a user sets an offset of 100 pixels, when they click on an anchor link, the page would scroll in a way that leaves 100 pixels of space between the top of the target element and the top of the viewport. This would improve the overall user experience, especially on sites with fixed headers.
Please let me know if you have any questions or need further clarification an example could be found here.