滚动到相对于锚点的位置

时间:2011-11-22 21:03:59

标签: javascript jquery html scroll anchor

我想滚动到一个位于锚点之前20px的位置。对此最好的解决方案是什么?

编辑:我将使用scrollTo with jquery。无法弄清楚window.location.hash。

1 个答案:

答案 0 :(得分:5)

滚动到锚点(可能会设置window.location.hash),然后执行window.scrollBy(0, -20)

相关问题