zoukankan      html  css  js  c++  java
  • 界面滑动+ztree

     链接:http://pan.baidu.com/s/1dE2DfH3 密码:iy2i

    参考:http://blog.csdn.net/cuiran/article/details/7659094

    jsp:放在body内

    <div id = "floatWin" class="floatWin">
    	       <div id = "floatName" class="floatName">
    		   		<span class="floatTitle">设备选择</span>
    		   </div>
    	       <div id = "floatNodes" class="floatNodes">
    		       			<ul id="nodes" class="ztree"></ul>
    		   </div>			
    </div>
    

    css:

    /**节点树*/
    .floatWin {
    	 22px;
    	height: 250px;
    	z-index: 999;
    	position: absolute;
    	right: 0;
    	top: 30px;
    	display: block;
    }
    
    .floatName {
    	padding-top: 14px;
    	border-top-left-radius: 10px;
    	border-bottom-left-radius: 10px;
    	background-color: #2C63B3;
    	margin-top: 35px;
    	cursor: pointer;
    	 22px;
    	height: 75px;
    	display: block;
    	overflow: hidden;
    	float: left;
    	text-align: center;
    	font-size: 14px;
    	color: #FFF;
    }
    
    .floatTitle {
    	font-size: 14px;
    	font-weight: bold;
    }
    
    .floatNodes {
    	 0px;
    	height: 250px;
    	float: left;
    	background-color: #C9E7FC;
    }
    
    ul.ztree {
    	border: 1px solid #3378c2;
    	border-right-color: #b5cfea;
    	background: #DBECFC;
    	 228px;
    	height: 237px;
    	overflow-y: auto;
    	overflow-x: auto;
    }
    

    js:

    $(document).ready(function() {
    	$("#floatName").click(function(){
    		var winWidth = jQuery("#floatWin").width();
    		if(winWidth==262){
    			var floatNodes = jQuery("#floatNodes").width();
    			jQuery("#floatWin").animate({winWidth-240},1000,function(){});
    			jQuery("#floatNodes").animate({floatNodes-240},1000,function(){});
    		}
    		if(winWidth==22){
    			var floatNodes = jQuery("#floatNodes").width();
    			jQuery("#floatWin").animate({winWidth+240},1000,function(){});
    			jQuery("#floatNodes").animate({floatNodes+240},1000,function(){});
    		}
    	});
    	var setting = {
    			check: {
    				enable: true,
    				chkStyle: "checkbox",
    				chkboxType: { "Y" : "ps", "N" : "ps" },
    				chkDisabledInherit: true
    			},
    			data: {
    				simpleData: {
    					enable: true
    				},
    				key: {
    	                title: "title"
    	            },
    			}
    	};
    	/* var zNodes =[
    		{ id:1, pId:0, name:"随意勾选 1", open:true},
    		{ id:11, pId:1, name:"随意勾选 1-1", open:true},
    	]; */
    	vwf.ajax({
            url:"/nodemanage/showNodeTree.action",
            data:"",
            success:function(msg){
            	var nodes = msg.nodes;
            	$.fn.zTree.init($("#nodes"), setting, nodes);
            }
        });
    	
    });
    function getSelectNodes(){
    	var treeObj = $.fn.zTree.getZTreeObj("nodes");
    	var nodes = treeObj.getCheckedNodes(true);
    	console.log("nodeLength:"+nodes.length);
    	var ids = "";
        for(var i=0;i<nodes.length;i++){
        console.log(nodes[i].id+":"+nodes[i].name+":"+nodes[i].pId); //获取选中节点的值
        if(nodes[i].id!="root"){
        	ids+=nodes[i].id+",";
        }
        }
        ids = ids.trim().substring(0, ids.length-1); 
        console.log("ids:"+ids);
    }
    

    treeNode.java

    public class TreeNode {
    	private String id;  
        private String pId; 
        private String title;
        private String name;  
        private Boolean checked;
        private Boolean chkDisabled;
        private Boolean open;
        public TreeNode() {
    	}
    }
    

    设置圆角div:

    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;

  • 相关阅读:
    (二十五)Struts2 Tiles集成
    (二十四)Struts2 Spring集成
    etcd 和 redis的使用场景
    react v16.12 源码阅读环境搭建
    gmail邮箱怎么批量删除邮件
    动态创建的元素怎么做动画
    Window 添加定时任务
    commons-pool2-中的一些配置
    Activiti 5.18 流程Model 转成 流程BPMN文件
    Activiti 使用自己的身份认证服务
  • 原文地址:https://www.cnblogs.com/sj521/p/5462661.html
Copyright © 2011-2022 走看看