更新时间:2019-09-26 22:02:39
引入jquery与index.js
<script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <script type="text/javascript" src="./public/index.js"></script>
构造函数
参数定义
- node:节点 - icon1:标题图标,将图标类放在数组中,["icon-biaoti","icon-biaoti","icon-biaoti"] - icon2:菜单关闭图标,["icon-jiantouarrow487","icon-jiantouarrow487","icon-jiantouarrow487"] - icon3:菜单开启图标,["icon-jiantouarrow483","icon-jiantouarrow483","icon-jiantouarrow483"] - new MenuIcon(node,icon1,icon2,icon3);
dom结构
<ul class="menu"> <li> <div class="item"> <i class="iconfont"></i> <span class="title">Title 1</span> <i class="iconfont"></i> </div> <div class="item-content"> <h3><a href="#">Writing content 1</a></h3> <h3><a href="#">Writing content 1_1</a></h3> <h3><a href="#">Writing content 1_2</a></h3> <h3><a href="#">Writing content 1_3</a></h3> </div> </li> ... </ul>