jquery Ztree v3.5 实例2 自定义显示在节点前的图片

转载地址    http://blog.csdn.net/moneyzhong/article/details/10088313

最终显示效果如下:

代码如下:


  
  
  1. <html>  
  2.     <head><title></title></head>  
  3.     <script type="text/javascript" src="jquery-1.10.2.js"></script>  
  4.     <script type="text/javascript" src="jquery.ztree.all-3.5.min.js"></script>  
  5.     <link href="zTreeStyle.css" rel="stylesheet" type="text/css"/>  
  6.         <style type="text/css">  
  7. .ztree li span.button.pIcon01_ico_open{margin-right:2px; background: url(img/diy/1_open.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}  
  8. .ztree li span.button.pIcon01_ico_close{margin-right:2px; background: url(img/diy/1_close.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}  
  9. .ztree li span.button.pIcon02_ico_open, .ztree li span.button.pIcon02_ico_close{margin-right:2px; background: url(img/diy/2.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}  
  10. .ztree li span.button.icon01_ico_docu{margin-right:2px; background: url(img/diy/3.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}  
  11. .ztree li span.button.icon02_ico_docu{margin-right:2px; background: url(img/diy/4.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}  
  12. .ztree li span.button.icon03_ico_docu{margin-right:2px; background: url(img/diy/5.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}  
  13. .ztree li span.button.icon04_ico_docu{margin-right:2px; background: url(img/diy/6.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}  
  14. .ztree li span.button.icon05_ico_docu{margin-right:2px; background: url(img/diy/7.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}  
  15. .ztree li span.button.icon06_ico_docu{margin-right:2px; background: url(img/diy/8.png) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}  
  16.     </style>  
  17.     <script type="text/javascript">  
  18.     var setting = {  
  19.             data: {  
  20.                 simpleData: {  
  21.                     enable: true  
  22.                 }  
  23.             }  
  24.         };  
  25.   
  26.     var zNodes =[  
  27.             { id:1, pId:0, name:"展开、折叠 自定义图标不同", open:true, iconSkin:"pIcon01"},  
  28.             { id:11, pId:1, name:"叶子节点1", iconSkin:"icon01"},  
  29.             { id:12, pId:1, name:"叶子节点2", iconSkin:"icon02"},  
  30.             { id:13, pId:1, name:"叶子节点3", iconSkin:"icon03"},  
  31.             { id:2, pId:0, name:"展开、折叠 自定义图标相同", open:true, iconSkin:"pIcon02"},  
  32.             { id:21, pId:2, name:"叶子节点1", iconSkin:"icon04"},  
  33.             { id:22, pId:2, name:"叶子节点2", iconSkin:"icon05"},  
  34.             { id:23, pId:2, name:"叶子节点3", iconSkin:"icon06"},  
  35.             { id:3, pId:0, name:"不使用自定义图标", open:true },  
  36.             { id:31, pId:3, name:"叶子节点1"},  
  37.             { id:32, pId:3, name:"叶子节点2"},  
  38.             { id:33, pId:3, name:"叶子节点3"}  
  39.         ];  
  40.   
  41.     $(document).ready(function(){  
  42.             $.fn.zTree.init($("#tree"), setting, zNodes);  
  43.         });  
  44.     </script>  
  45.     <body>  
  46.         <ul id="tree" class="ztree"></ul>  
  47.     </body>  
  48. </html>  
转载地址    http://blog.csdn.net/moneyzhong/article/details/10088313

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值