page-scroll-to-id
page-scroll-to-id copied to clipboard
Offset is not applied
When a tab is clicked, the offset is taken into account and and the page will scroll to the target element plus the offset pixels.
However, when scrolling, the offset is not taken into account and the active link is activated when the target is at the very top of the screen, ignoring the offset.
I hope you can find the time to respond.
I can't really help unless I see your page. Can you post a link and the steps to replicate the issue?
https://codepen.io/anon/pen/mwJNxQ?editors=1000 with an offset of 100, when you click a tab the page scrolls to the target plus the offset. However the corresponding tab is activated, but not when the target reaches the header. Meaning the offset is ignored when manually scrolling.
Yes, this is the expected behavior. Highlighting works independently from the target scroll-to position and offset.
Plugin's highlighting feature is completely user-centric. It works as an indicator to the user as to which section he/she is currently viewing. All that matters for the plugin script, is whether or not a section is within the visual field of the user (from top or bottom). It is not dependant on where the link scrolls (at which the offset applies).
Hope this helps
Would you please add an option that highlights the tab based on the target plus the offset when the user scrolls manually?
I can't really say if or when such option will be implemented as it'll probably interfere with other highlighting options and its core scope (such feature will require a lot of testing in various layouts).
I understand and hope you can implement it some day. It would make the plugin perfect. Thank you for your work.
You're welcome :)