ybnav
v1.1.1
Published
mobile nav plugin
Downloads
7
Readme
使用
npm
npm install --save ybnav
import YBnav from 'ybnav'
import 'ybnav/dist/ybnav.css'
直接引用
<link href="ybnav.css" />
<script src="nav.js"></script>
初始化
<div class="ybnav-container">
<div class="ybnav-wrapper">
</div>
</div>
var nav = new YBnav(el, options)
配置
- navItem 每个item的类, 如 '.nav-item'
- bounce 是否回弹 boolean值
- clickItem 点击标签的回调方法
- space 每个标签的间隔
方法
- addNav() 添加nav 如:addNav('新标签')
- removeNav(index) 删除指定index的nav,从0开始
- setActive(index) 把第index个设置成acitve,从0开始
- scrollTo(index) 滚动到指定的标签,从0开始