js scroll to id
// Js
document.getElementById('id').scrollIntoView();
// JQuery
$('#id')[0].scrollIntoView();
4
5
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#myDiv").offset().top
}, 2000);
});
Thank you!
5
0
Are there any code examples left?
New code examples in category Javascript