I am currently linking to an anchor point on the same page and the code below achieves this with a scrolling effect. However, I want to put the anchor on a different page.
What I'd like is that when I click the button (.ebooks-button) it opens the page and scrolls down to the anchor.
Here is the code that I'm currently using. Can anybody please suggest a modification in the javascript to help me achieve this?
$(document).ready(function() {
var away = false;
$('.ebooks-button').click(function() {
$("html, body").animate({scrollTop: $('#ebooks').offset().top}, 700);
});
});
//Add this in your css
html {
scroll-behavior: smooth;
}
//Try this hope it will help
<a href="ebooks.html#ebooks">Ebooks button</a>