使用Javascript / Jquery滚动到页面上的特定位置 [英] Scroll to a specific position on a page using Javascript / Jquery

查看:101
本文介绍了使用Javascript / Jquery滚动到页面上的特定位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以使用 #elementId 移动到页面上的某个位置。我怎么能用Javascript / Jquery做同样的事情。当调用JS函数时,我想滚动到该页面上的特定位置。

It is possible to move to a certain position on a page using #elementId. How can I do the same thing using Javascript / Jquery. When a JS function is called, I want to scroll to the specific position on that page.

推荐答案

经过大量谷歌搜索后我发现你只需要这样做:

After much googling I found that you just need to do this:

location.hash = "elementId"

这篇关于使用Javascript / Jquery滚动到页面上的特定位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆