scrollto is not a function javascript 1

scrollto is not a function javascript

$("button").on('click', function() {
	window.scrollTo({
    top: $('#intro').offset().top,
    left: 0,
    behavior: 'smooth'
  })
});

Here is what the above code is Doing:
1. When the user clicks on the button, the page will scroll to the top of the intro section.
2. The scrollTo() method takes an object as an argument.
3. The object has three properties: top, left, and behavior.
4. The top property is the distance from the top of the page to the top of the intro section.
5. The left property is the distance from the left of the page to the left of the intro section.
6. The behavior property is set to smooth, which means the page will scroll smoothly to the top of the intro section.

Similar Posts