3000 explained code solutions for 75 technologies


jqueryScroll to a specific element


$('body').animate({ scrollTop: $('#element').offset().top }, 2 * 1000);ctrl + c
$('body')

selects document body

animate

animates given properties

'#element'

selector for an element we want to scroll to

.offset().top

get Y coordinate for the given element

2 * 1000

will animate scroll for 2 seconds