我想跳转到页面的特定部分/组件。所以我使用了 React-Scroll 但它总是从顶部开始滚动。但我想从我在页面上的位置滚动。下面是代码片段。
import {Link as ScrollLink} from 'react-scroll'
class NavbarHeader extends Component {
render() {
return(
<div className="collapse navbar-collapse" id="realdeal_main_menu">
<ul className="navbar-nav menu-open readeal-top">
<li className="menu-item-has-children">
<a >Platform</a>
<ul className="sub-menu">
<li><ScrollLink to="features" smooth={true} spy={true} isDynamic={true}>Feature</ScrollLink></li>
<li><ScrollLink to="process" smooth={true} spy={true} isDynamic={true}>Process</ScrollLink></li>
</ul>
</li>
</ul>
</div>
这是主要组件`
<div id="features" className="pt-70 _21-wave-bg-top "><img src=
{publicUrl+'assets/img/banner/section-bg.png'} className="feature-bg-top" /></div>
<TeamV2 Customclass="pd-top-90" />
<div className="pt-70 _21-wave-bg-btm"><img src={publicUrl+'assets/img/banner/section-bg-down.png'} className="feature-bg-top" /></div>
<div id="process"><Dream /></div>
)}}
`