zoukankan      html  css  js  c++  java
  • 关于easyui-accordion的添加以及显示隐藏菜单的使用

    <script type="text/javascript">
       
       $(function()
       {
             leftMenus();
       });
       
       function leftMenus()
       {
           var _menus=<%=jsonStr %>;
             //$(".easyui-accordion").empty();
             $.each(_menus.menus, function(i, n) {
                  $(".easyui-accordion").accordion('add',
                    {
                       title: n.text,
                       content:moduleIndex(n.menus)
                 });
            });
            $(".easyui-accordion").accordion();
                    $('.easyui-accordion li a').click(function()
                    {
                        var tabTitle = $(this).text();
                        var url = $(this).attr("href");
                        //alert(url);
                        addTab(tabTitle,url);
                        $('.easyui-accordion li div').removeClass("selected");
                        $(this).parent().addClass("selected");
                   }).hover(function()
                   {
                        $(this).parent().addClass("hover");
                   },function()
                   {
                        $(this).parent().removeClass("hover");
                   });   
       }
       
       function addTab(subtitle,url){
        if(!$('#tabs').tabs('exists',subtitle)){
            $('#tabs').tabs('add',{
                title:subtitle,
                content:createFrame(url),
                closable:true,
                $('#mainPanle').width()-10,
                height:$('#mainPanle').height()-26
            });
        }else{
            $('#tabs').tabs('select',subtitle);
        }
        //tabClose();
    }
    
        function createFrame(url)
        {
            var s = '<iframe name="mainFrame" scrolling="auto" frameborder="0"  src="'+url+'" style="100%;height:100%;"></iframe>';
            return s;
        }
        
       function moduleIndex(menusData)
       {
          var text="";
          text += '<ul>';
          $.each(menusData,function(j,o)
          {
              text += '<li><div ><a target="mainFrame" href="'+o.attributes+'" >' + o.text + '</a></div></li> ';
          });
          text += '</ul>';
          return text;
       }
        </script>
    <body id="cc" class="easyui-layout">
        <div data-options="region:'west',split:true" title="导航菜单" style=" 200px;">
            <div class="easyui-accordion" data-options="fit:true,border:false">
            
            </div>
        </div>
        <div id="mainPanle" data-options="region:'center'">
         <div id="tabs" class="easyui-tabs"  fit="true" border="false" >
                <div title="欢迎使用" style="padding:20px;overflow:hidden;" id="home">
                    
                <h1>欢迎您使用,报表在线查询系统</h1>
    
                </div>
            </div>
        </div>
    </body>

     展示效果图片:

  • 相关阅读:
    centos crash debug
    go get Unknown SSL protocol error in connection to gopkg.in
    Tensorflow serving with Kubernetes
    Spring 集成 Swagger UI
    Docker Registry V2 Garbage Collection
    Docker Registry V2 with Nginx
    Zabbix磁盘性能监控
    Zabbix CPU utilization监控参数
    Windows挂载Gluster复制卷
    Redis持久化存储(三)
  • 原文地址:https://www.cnblogs.com/ToFlying/p/3511605.html
Copyright © 2011-2022 走看看