I can’t seem to figure this out. I am using jquery to smooth scroll between anchor points and half the time it works and half the time it doesn’t.
For example the “Home” link is set to anchor point “#top” and it works everytime that i’ve seen.
But the “top” arrow that I have in the bottom, right corner of the screen, that is also set to the anchor point “#top”, doesn’t scroll all the way to the anchor point anytime it is clicked.
$('a[href^="#"]').on("click", function (e) {
e.preventDefault();
var target = this.hash;
var $target = $(target);
$("html, body")
.stop()
.animate(
{
scrollTop: $target.offset().top
},
900,
"swing",
function () {
// window.location.hash = target;
}
);
$('.menu').removeClass('active');
$('.navi').removeClass('active');
});
The menu and navigation are “fixed” but the top arrow animates into the bottom right corner once the page scrolls past a certain point. overflow on body is set to hidden so the menu and the top arrow are the only ways to scroll.
Anyone got any ideas?
1