# 平滑滚动到节点

页面平滑滚动到id或者class节点

使用
import { smoothScroll } from 'util-snippets';

/**
 * 示例:smoothScroll('#fooBar'); 
 * 示例:smoothScroll('.fooBar');
 */

smoothScroll(id);
smoothScroll(class);
代码
const smoothScroll = element =>
  document.querySelector(element).scrollIntoView({ behavior: 'smooth' });