Answers for "html auto scroll to element"

10

javascript scroll to element

document.getElementById("divId").scrollIntoView();
Posted by: Guest on February-28-2020
0

js auto scroll in div

<style>

	.scroll-text{
		overflow-y: auto;
		height: 61px;
        width:auto;

	}


</style>


			<div class="scroll-text" id="data">
            f
		
        
        
        
			</div>


  
      <script>
var my_time;
var count = 0;
setTimeout('pageScroll()', 1200);
function pageScroll() {
  if (count < 2) {
    var objDiv = document.getElementById("data");
    objDiv.scrollTop = objDiv.scrollTop + 1;
    if (objDiv.scrollTop == objDiv.scrollHeight - 61) {
      setTimeout(function () {
        objDiv.scrollTop = 0;
        count++;
      }, 1200);
    }
    my_time = setTimeout('pageScroll()', 30);
  }
}
    </script>
Posted by: Guest on March-18-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language