如何在 React 中偏移链接和锚点?
How to offset links and anchors in React?
我无法在我的 React 应用程序中偏移锚标记的跳转点。无论我如何调整 paddings、margins 和 top;我得到相同的结果。我尝试的最后一件事是 react-router-hash-link-offset 并且除了滚动之外它的行为完全相同。
<li className="app-link"><Link to="#section1" smooth scrollOffset="100">Summary</Link></li>
<div className="app-section" id="section1">
<h3>Summary</h3>
</div>
此时我愿意接受任何建议。
使用这个库来实现这个功能。
我无法在我的 React 应用程序中偏移锚标记的跳转点。无论我如何调整 paddings、margins 和 top;我得到相同的结果。我尝试的最后一件事是 react-router-hash-link-offset 并且除了滚动之外它的行为完全相同。
<li className="app-link"><Link to="#section1" smooth scrollOffset="100">Summary</Link></li>
<div className="app-section" id="section1">
<h3>Summary</h3>
</div>
此时我愿意接受任何建议。
使用这个库来实现这个功能。