原生js实现的简单的锚点滚动插件
smooth-scroll-lite
原生js实现的简单的锚点滚动插件
smooth-scroll-lite 基本用法 API 基本用法 初始化 var smoothScroll = new SmoothScroll({
easing: 'easeInCubic',
speed: 1000
})
js调用
smoothScroll.scrollTo(document.querySelector('#position2'))
锚点绑定
<li><a href="#position1" smooth-scroll-id>一</a></li>
<li><a href="#position2" smooth-scroll-id>二</a></li>
<li><a href="#position3" smooth-scroll-id>三</a></li>
API
参数 | 类型 | 说明 | 默认 |
---|---|---|---|
speed | Number | 动画时间 | 500 |
easing | String | 动画类型 | easeInCubic |
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。