Archived topic
Internal Link
5 replies · Started by afuente26 on July 13, 2021
Hello again,
I have a recurrent issue.
When I insert an internal link in the menu, to another point inside the page, the link brings me to the point I need, but the menu is above.
Any idea?
Thanks
Angel
Hi there,
This should help:
https://docs.generatepress.com/article/smooth-scroll/
Thanks a lot. The video is very good explained.
I´ve done already what the video says, but I have still the same problem.
First, I have to add
html {
scroll-behavior: smooth !important;
}
to the css, otherwise, it doesn´t work. Ok. Thanks not really bad.
Second, and this is what I don´t like, is that the linked text (or whatever) stays UNDER the menu, not behind it.
You can try yourself to see what I meen...
Thanks again..
Angel
Hi there,
For this, I believe it's either you do the padding+margin trick on the destination element or,
use a script that allows you to add offset to the anchors.
You can try the jQuery script provided here - https://generatepress.com/forums/topic/anchor-links-load-behind-sticky-header/#post-991786 - and play around with the offset value.
Thanks a lot Elvin,
finally, I´ve found an easy and quick solution, that I want to share.
:target:before {
content: "";
display: block;
height: 100px;
margin: -100px 0 0;
}
@media (max-width: 768px) {
:target:before {
content: "";
display: block;
height: 60px;
margin: -50px 0 0;
}
}
Thanks a lot again. I´m really glad with your template and your support.
Greetings
Angel
Nice one! Thanks for sharing. Glad you got it sorted. :D