滚动到相对于锚点的位置

And*_*sen 3 html javascript anchor jquery scroll

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

编辑:我将使用带有jquery的scrollTo.无法弄清楚window.location.hash.

Ry-*_*Ry- 5

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