首页 > 解决方案 > 在jquery加载功能中将页面滚动到顶部

问题描述

我尝试了什么:

$('#content').load("/education.php?filter_page=kurs&selected_kurs_id=" + selectedKursId + "&selected_category_id=" + selectedCategoryId  + "&kursId=" + positionKurs, function(){
     $(this).scrollTop(0);

});

内容加载后如何向上滚动页面?

标签: javascriptjquery

解决方案


尝试与您发布的相同的 .load :

$('#content').load("/education.php?filter_page=kurs&selected_kurs_id=" + selectedKursId + "&selected_category_id=" + selectedCategoryId  + "&kursId=" + positionKurs);

education.php里面添加:

<script>
    $("html, body").animate({ scrollTop: 0 }, "slow");
</script>

推荐阅读