- This topic has 9 replies, 2 voices, and was last updated 4 years, 3 months ago by Leo.
-
AuthorPosts
-
December 18, 2019 at 3:45 am #1107598Samuel
Hi,
I use the smooth-scroll option for anchor link and a sticky menu. When I put an anchor on accordion items it lands on body part of the accordion and title part is hidden by sticky menu, like shown in link.
I don’t know if it’s the normal behaviour or not, maybe it is, but if so is there anyway to add a margin-top or something to the landing of the anchor links ?
thanks !
December 18, 2019 at 8:22 am #1107933LeoStaffCustomer SupportHi there,
Can you confirm that you are using GP’s smooth scroll script?
https://docs.generatepress.com/article/smooth-scroll/If so it should account for the sticky navigation height by default.
Let me know π
December 18, 2019 at 8:26 am #1107940SamuelAs I said :
I use the smooth-scroll option for anchor link”
Did you check the link I gave to you ?
I don’t know what to add at what I explained, here it is again : I think anchor in this case is displayed in the body part of accordion, it would explain title is hidden by sticky menu, so I would need to add a margin-top or something similar to add space and be able to see accordion title.
December 18, 2019 at 10:09 am #1108041LeoStaffCustomer SupportCan you try setting the anchor on the accordion title?
That’s the only solution I believe.
Let me know π
December 18, 2019 at 10:53 am #1108077SamuelHi,
As seen here : https://www.screencast.com/t/S8JIcatuBJL
The anchor is on the DIV attribute, so it should display title shouldn’t it ?According to you there is no way to set a margin-top to the anchor position landing ?
December 18, 2019 at 11:26 am #1108112LeoStaffCustomer SupportHuh..for some reason I’m seeing different HTML comparing to what you are showing:
https://www.screencast.com/t/TnXxxcNwqHuI’m not seeing the
smooth-scroll
class or the div ID.It’s very hacky to use CSS for anchor position which is why we implemented automatically with the sticky navigation:
https://generatepress.com/forums/topic/jump-too-anchors-headings-covered-by-stick-navigation/#post-887181David provided a workaround/hacky solution here:
https://generatepress.com/forums/topic/jump-too-anchors-headings-covered-by-stick-navigation/#post-887821December 18, 2019 at 11:39 am #1108124SamuelI found a solution that is working, I apply a class (e.g. “anchor”) to my accordion block and add this CSS :
.anchor {
padding-top: 5em;
margin-top: -5em;
}Adjust as needed.
Thanks
December 18, 2019 at 11:40 am #1108125LeoStaffCustomer SupportGlad you found a solution!
December 18, 2019 at 11:50 am #1108133SamuelJust to finish about the smooth-scroll, I added the script in my function.php to apply smooth-scroll to every anchor links. So it’s normal you don’t see any class on my DIV or so. π
December 18, 2019 at 11:52 am #1108135LeoStaffCustomer SupportAwesome thanks for reporting back π
-
AuthorPosts
- You must be logged in to reply to this topic.