js function on scrolling to element code example Example: javascript scroll to element document.getElementById("divId").scrollIntoView();