I am aware of the below function, which will scroll to a defined element when a page is loaded:
$(document).ready(function () {
// Handler for .ready() called.
$('html, body').animate({
scrollTop: $('[class-name]').offset().top
}, 'slow');
});
However, I would like this function to run only when the page is accessed by the <a class="[class-name]" href="[destination-url]" </a>
currently in a banner on the home page, which is there temporarily to bring attention to some information on the destination page.
I don't want this function to run when the same page is accessed via the main sidebar menu, or other links.
How would I go about this?