scroll using pure javascript

To scroll down to an element in the page. The best way is to use function scrollIntoView

Pure javascript

var theElement = document.getElementById(‘yourElementId’);
theElement.scrollIntoView();

Using jquery to select element:

$(SELECTOR)[0].scrollIntoView();

Leave a Reply

Your email address will not be published. Required fields are marked *