anchor.js 是一款简单且有非常实用的 jQuery 插件,为所有本地链接提供一个平滑的动画,然后跳转到页面的任意一个元素。
/**
* Example 1
* Add anchors to all h1's on the page
*/
anchors.add('h1');
/**
* Example 2
* Adds anchors to elements that have been assigned the class '.anchored'
*/
anchors.add('.anchored');
/**
* Example 3
* If no selector is provided, it falls back to a default selector of:
* 'h2, h3, h4, h5, h6'
*/
anchors.add();
官方地址 :https://www.bryanbraun.com/anchorjs/
github 地址 :https://github.com/bryanbraun/anchorjs