Hi,
I’m using a scroll to section on my homepage, but the scroll is going to the bottom of the section instead of it’s beginning, which makes everything confusing.
Can anyone help me make the scroll to about this height , so that the header won’t stay out
WEBSITE: bentobay.de
password: bawvay
( This is the scroll to section: #shopify-section-template–21197290144073__rich_text_m9fD6c )
thank you so much in advance
Hello @Daniel19901 , Your provided password is invalid the password. Please give a valid password.
@Darshanp712
Sorry! the password is: bawvay1
Hello @Daniel19901 , Please add your anchor tag like below I have made changes to it.
JETZT SICHERN!
Add the below javascript to this section file or else make a custom JS file if you want.
function scrollToDiv(divId) {
const div = document.getElementById(divId);
const scrollTop = div.getBoundingClientRect().top + window.pageYOffset - div.clientHeight;
window.scrollTo({ top: scrollTop, behavior: 'smooth' });
}
Please check this make changes to your section file and reply if you have any queries.
If I managed to help you then, don’t forget to Like it and Mark it as a Solution!
Best regards,
Darshan Prajapati.
@Darshanp712 thank you so much!!
To which folder should I add this? theme-liquid ?
JETZT SICHERN!