Scroll to Element Example

This example will scroll to a specific element on the page.

import scrollTo from "DEGJS/scrollTo";

let destinationElement = document.querySelector('#example2');
scrollTo({
  element: destinationElement
});

Scroll with Custom Duration

This example will scroll with a duration of 3 seconds.

import scrollTo from "DEGJS/scrollTo";

let destinationElement = document.querySelector('#example3');
scrollTo({
  element: destinationElement,
  duration: 3000
});

Scroll with Easing Example

This example will scroll with an ease-in animation.

import scrollTo from "DEGJS/scrollTo";

let destinationElement = document.querySelector('#example3');
scrollTo({
  element: destinationElement,
  duration: 1500,
  easing: 'easeIn'
});

Scroll to Position Example

This example will scroll to a specific position on the page.

import scrollTo from "DEGJS/scrollTo";

scrollTo({
  position: 0
});