Transition to named anchor after jquery / javascript processing

How to move focus to another section (named anchor) on one page after doing some jquery processing.

The ABC () function does some processing and then, I need to move the user to a section on the same page (further down the page).

+5
source share
2 answers

You can use the code below to scroll the screen to <div id="navigation">. Just change the selector to fit the element you want to scroll through.

$('html, body').animate({ scrollTop: $('#navigation').offset().top }, 'slow');
+11
source

location.href=location.href.replace(/#.+/,'')++'#namedanchor' or

document.getElementById('#namedanchor').scrollIntoView(true)

The first one adds a hash to the URL of the address

+1
source

All Articles