jQuery Scroll To Position Demo

This scroll demo will scroll the page to a specific DIV on the page. This demo works by calling a function and that function then scrolls the page to the DIV passed. 
function scrollToSection(containerID)
   var target = $('#' + containerID);

   $('html, body').animate({
           scrollTop: target.offset().top
   }, 1000);

<button onclick="scrollToSection('section2');">Scroll to Section II</button>
Comments are closed