javascript - 如何在 HTML 中自动垂直滚动到一行?

标签 javascript jquery html css

<分区>

我不确定我能否很好地描述这一点。我想在 HTML 内容中添加一个元素,它会在加载时自动要求浏览器垂直滚动到那里。像一个 anchor 。所以:

| visible area |
| content html |
| content html |        our monitor
| content html |
| content html |
----------------
|
|
| * here comes the HTML element which will ask the browser to scroll here
|
|

最佳答案

$(document).ready(function()
{
     $("html,body").animate({scrollTop: 200}, 1000);
}

没有测试所以如果它行不通请告诉我

关于javascript - 如何在 HTML 中自动垂直滚动到一行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26192215/

上一篇:css - 谷歌浏览器边框半径问题

下一篇:html - 并排Divs?

相关文章:

javascript - graphql 中突变后的查询

javascript - 创建查询参数以设置开始和结束日期/时间

jquery - JsTree - 通过单击父节点展开

javascript - 保存位置的可排序 Div

html - 在特殊斜 Angular css 形状周围创建边框?

javascript - fusion-tables,需要帮助从表中获取最新数据并将其插入 map 代码中

javascript - 提交表单时停止执行计时器函数

javascript - 使用 json 中的值填充输入字段

javascript - 如何根据php中的小计和运费计算总金额?

.net - 将 HTML 内容格式化为可打印报告