I'm trying to get it when the #name
div is pressed, the page will scroll to #profile-pic
but not having any luck.
$("#name").click(function() {
$('html, body').animate({
scrollTop: $("#profile-pic").offset().top
}, 2000);
});
答案 0 :(得分:3)
Because the scrollable part is a div, not the page. You need to select the div to scroll.
$('#left-panel').animate({