Created
August 6, 2019 03:59
-
-
Save ngocongcan/4b56d2d93ccea7cf3493fdc935462dc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> | |
<script> | |
$(document).ready(function (){ | |
$("#click").click(function (){ | |
$('html, body').animate({ | |
scrollTop: $("#div1").offset().top | |
}, 2000); | |
}); | |
}); | |
</script> | |
<div id="div1" style="height: 1000px; width 100px"> | |
Test | |
</div> | |
<br/> | |
<div id="div2" style="height: 1000px; width 100px"> | |
Test 2 | |
</div> | |
<button id="click">Click me</button> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment