How to set scroll to bottom in jquery? - ItSolutionStuff.com

PHOTO EMBED

Tue Aug 23 2022 11:30:18 GMT+0000 (UTC)

Saved by @PBSH56 #html

<html lang="en">

<head>

	<title>Scroll Down bottom</title>

	<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

</head>

<body>

	<div class="scroll-class" style="border: 1px solid black;height: 200px;overflow: scroll;width: 300px;">

		<p>

			Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

			tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,

			quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo

			consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse

			cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non

			proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

		</p>

	</div>

    <script type="text/javascript">

	     var objDiv = $(".scroll-class");

    	 var h = objDiv.get(0).scrollHeight;

    	 objDiv.animate({scrollTop: h});

    </script>

</body>

</html>
content_copyCOPY

https://www.itsolutionstuff.com/post/how-to-set-scroll-to-bottom-in-jqueryexample.html