javascript - 在jquery加载功能中将页面滚动到顶部
问题描述
我尝试了什么:
$('#content').load("/education.php?filter_page=kurs&selected_kurs_id=" + selectedKursId + "&selected_category_id=" + selectedCategoryId + "&kursId=" + positionKurs, function(){
$(this).scrollTop(0);
});
内容加载后如何向上滚动页面?
解决方案
尝试与您发布的相同的 .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>
推荐阅读
- javascript - 覆盖空白空间和元素的 Div 似乎无法点击(Python Selenium)
- django - 如何在列表方法中使用多个排序的序列化程序进行分页 django rest 框架视图
- vb.net - 如何使用 vb.net 检查服务器上的计划任务?
- angular - 无法绕过 angular sanitize 安全性
- javascript - 引导会话超时,外部重置计时器
- sql - 查找唯一行
- java - 错误期望成员声明和 Kotlin
- bash - 在 bash 脚本中拆分字符串
- php - 在输入文本中输入值并在另一个表中描述
- javascript - 如果某些日期大于其他日期,如何检查 AngularJs