scrollTo()

Scrolls an element into view with smooth animation.

scrollTo(options)

$('#section').scrollTo();

Parameters:

  • options: Configuration object (e.g., { behavior: 'smooth', block: 'center' }).

Usage:

$('#section').scrollTo({ behavior: 'smooth', block: 'center' });

This will scroll to where the element with the id of section is.

$('#section').scrollTo();

Last updated