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;

  • 相关阅读:
    值类型和引用类型
    Visual Staudio 2015 打开指定文件,定位到指定文件目录下
    c# datarow[] 转换成 datatable, List<T> 转datatable
    存储过程存储过程需要用两个'',先where再Group,再Order by
    SQL之case when then用法
    select 1 from table 语句中的1代表什么意思
    SqlServer使用表值函数汇总
    SQLServer2008或SQLServer2008 R2没有智能提示解决方法
    Linux下./configure && make && make install 编译安装和卸载
    Linux下web服务的搭建
  • 原文地址:https://www.cnblogs.com/sj521/p/5462661.html
Copyright © 2011-2022 走看看