One issue I have encountered is with a link that, when clicked, should scroll down to a specific element on the page.
However, every time I test this feature, there seems to be an inconsistency where the page may momentarily flash before scrolling as intended.
This is the link in question:
<a id="continue_scroll" href="#welcome">Continue / Scroll</span></a>
The element to which it scrolls:
<h2 id="welcome">WELCOME</h2>
Here is the jQuery code used:
jQuery(function($){
$("#continue_scroll").click(function() {
$('html, body').animate({
scrollTop: $("#welcome").offset().top
}, 2000);
});
});
Issue: The problem occurs when I refresh the page and click the continue link multiple times or intermittently click elsewhere on the page. This inconsistent behavior is quite frustrating.
Does anyone know what might be causing this issue and how it can be resolved?