国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

jQuery EasyUI結合zTree樹形結構制作web頁面

2024-05-06 15:12:00
字體:
來源:轉載
供稿:網(wǎng)友

JQuery EasyUI 結合 zTree樹形結構制作web頁面.easyui用起來比較簡單,很好的封裝了jquery的部分功能,使用起來更加方便,但是從1.2.3版本以后,商業(yè)用途是需要付費的,zTree是國內(nèi)的大牛們搞的一個jquery樹形tree插件,感覺很好用,很強大,而且完全免費,API等做的也非常不錯.推薦

easyui 是一個基于 jQuery 的框架,集成了各種用戶界面插件。

easyui 提供建立現(xiàn)代化的具有交互性的 javascript 應用的必要的功能。

使用 easyui,您不需要寫太多 javascript 代碼,一般情況下您只需要使用一些 html 標記來定義用戶界面。

HTML 網(wǎng)頁的完整框架。

easyui 節(jié)省了開發(fā)產(chǎn)品的時間和規(guī)模。

easyui 非常簡單,但是功能非常強大。

需要的導入以下幾種js文件和樣式表

easyui/themes/default/easyui.css
easyui/themes/icon.css  
jquery-1.8.3.js
easyui/jquery.easyui.min.js
ztree/jquery.ztree.all-3.5.js(該文件包括core,exhide,exedit,excheck)
ztree/zTreeStyle.css

<script type="text/javascript">    // ztree菜單設置 var zTreeObj, setting = {  view: {   selectedMulti: false  },  // 添加編輯設置:修改樹節(jié)點名稱/刪除樹節(jié)點  edit: {   enable: true  },  data: {    simpleData: {     enable: true   }  },  callback:{   onClick: zTreeOnClick  } };  // 回調(diào)函數(shù):單擊事件 function zTreeOnClick(event, treeId, treeNode, clickFlag) {   alert(treeNode.id + ", " + treeNode.name);   var content = '<div style="width:100%;height:100% ;overflow:hidden;">'       +'<iframe src="'       +treeNode.url       +'" scrolling="auto" style="width:100%;height:100%;border:0;"></iframe></div>';  if(treeNode.url != undefined && treeNode.url != ""){   // 當centre中是否存在名稱為treeNode.name的tabs   if($("#tt").tabs('exists',treeNode.name)){    $("#tt").tabs('select',treeNode.name);   }else {    $("#tt").tabs('add',{     title:treeNode.name,     content:content,     closable:true    })   }  };  event.preventDefault(); };  // 提供ztree樹形菜單數(shù)據(jù) zTreeNodes = [ {"id":1, "pId":0, "name":"海賊王"},         {"id":11, "pId":1, "name":"娜美", "url":"http://man.linuxde.net/"},         {"id":12, "pId":1, "name":"羅賓", "url":"http://www.baidu.com"},        {"id":13, "pId":1, "name":"漢庫克", "url":"http://www.google.cn/"},        { "id":2, "pId":0, "name":"父節(jié)點 2", "open":true},        {"id":21,"pId":2, "name":"葉子節(jié)點 2-1"},        {"id":22, "pId":2, "name":"葉子節(jié)點 2-2"},        {"id":23,"pId":2, "name":"葉子節(jié)點 2-3"},        {"id":3, "pId":0, "name":"父節(jié)點 3", "open":true},        {"id":31, "pId":3, "name":"葉子節(jié)點 3-1"},        {"id":32, "pId":3, "name":"葉子節(jié)點 3-2"},        {"id":33, "pId":3, "name":"葉子節(jié)點 3-3"}       ];  // 3.生成樹形菜單 $(document).ready(function(){  zTreeObj = $.fn.zTree.init($("#tree"), setting, zTreeNodes); });  // 4.對象選項卡注冊右擊事件 $(document).ready(function(){  $("#tt").tabs({   onContextMenu:function(e,title,index){   // 阻止系統(tǒng)默認的右擊事件    e.preventDefault();    $('#mm').menu('show', {     left: e.pageX,     top: e.pageY    });    }  }); });  // 獲取所選取的面板對象 $(document).ready(function(){  $("#tt").tabs({   // 獲取所選取的面板對象   onSelect : function(title,index ){    // 5. menu的單擊事件綁定    $("#mm").menu({      onClick:function(item){       alert(item.name);      // 當點擊關閉當前選項卡時      if(item.name==='current'){       $('#tt').tabs('close',title);      // 當點擊關閉其他選項卡時      }else if(item.name === 'others'){       var tabs = $('#tt').tabs('tabs');       $(tabs).each(function(){        if($(this).panel('options').title != '消息中心' && $(this).panel('options').title != title){         $('#tt').tabs('close',$(this).panel('options').title);        }       });      // 當點擊關閉所有選項卡時      }else if(item.name === 'all'){       var tabs = $('#tt').tabs('tabs');       $(tabs).each(function(){          if($(this).panel('options').title != '消息中心'){         $('#tt').tabs('close',$(this).panel('options').title);        }       });      }     }     });   }  }) }) </script>             
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 叙永县| 郧西县| 灵武市| 日照市| 开化县| 林周县| 康定县| 霸州市| 博爱县| 罗江县| 屏东市| 伊宁县| 乌鲁木齐县| 邹城市| 凤庆县| 商城县| 宜川县| 区。| 株洲市| 天峨县| 精河县| 银川市| 洛隆县| 土默特左旗| 武隆县| 团风县| 巫山县| 元江| 祁门县| 渭南市| 页游| 汕头市| 黄石市| 通山县| 奇台县| 克东县| 宜城市| 察雅县| 富平县| 同心县| 洱源县|