当我单击单选按钮时,会显示一个新的 div“resultat3”。
我希望在加载新的 div 时自动向下滚动到它。
function stateChanged7()
{
if (xmlhttp.readyState==4)
{
document.getElementById("resultat3").innerHTML=xmlhttp.responseText;
document.getElementById("show").innerHTML = showDiv4(1);
}
}
有谁知道如何解决吗?
最佳答案
$('#html,body').animate({
scrollTop: $("#resultat3").offset().top
});
与这个已经回答的问题非常相似。希望对您有所帮助。
关于javascript - 自动滚动到新的 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29301593/