Saved X
Google login
SignUp with Email
X

jQuery scroll to div with a class name

theindreshverma ( Added  28 Oct 2021, 05:34 pm )
Login

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

</head>
<body>
<div style="height:1000px" >test div</div>
<div class="scroll" >scroll</div>

</body>
<script>

$("html,body").animate({scrollTop: $('.scroll').offset().top },300);

</script>
</html>

Sourcecode Tags

More Sourcecodes

More Sourcecodes