---
title: "可折叠的面板"
author: "yiminghe"
date: "2009-08-27T10:19:59Z"
tags: ["C", "C#", "C++", "EXT", "Google"]
slug: "untitled"
draft: false
lastmod: "2009-10-26T20:43:30Z"
id: 458256
url: "https://yiminghe.iteye.com/blog/458256"
---

[\[置顶\] Lite-Ext 适合WebPage的轻量级Ext](../../../blog/373571)

**在 [google code](http://lite-ext.googlecode.com/) 持续更新，这里停止**

[演示@google code](http://lite-ext.googlecode.com/svn/trunk/lite-ext/CollapseLite/collapselite.html)

 

 

本以为用 windowlite 就可以了，偏偏有需求要 dock 的效果，放一长条在那占位置，点的话就展开，实现下试试。

**效果：**

 

![](/upload/attachment/140750/75d78b89-9e6f-30e9-9771-a3920388b5b9.png)

**使用代码:**

 

```
//一般定位
	var c=new Ext.ux.CollapseLite({
		//标题头
		title:'一般定位测试头',
		//内容
		content:'一般定位测试content',
		//渲染容器id
		renderTo:'test1'
	});
	
	c.on("expand",function(){
		alert("expand occur !");
	});		
	
	c.on("collapse",function(){
		alert("collapse occur !");
	});
			
	//一般定位暂时不支持direction r
	new Ext.ux.CollapseLite({
		title:'一般定位测试头 - 不支持direction r',
		content:'一般定位测试content',
		direction:'r'
	});	
	
	
	//绝对定位		
  new Ext.ux.CollapseLite({
		title:'绝对定位测试头',
		content:'绝对定位测试content',
		style:'position:absolute;left:100px;top:300px;width:500px;'
	});
	
	
	
	//绝对定位支持direction r		
  new Ext.ux.CollapseLite({
		title:'绝对定位测试头 - 支持direction r',
		content:'绝对定位测试content',
		style:'position:absolute;left:100px;top:600px;width:500px;',
		//收缩方向
		direction:'r'
	});

 
```

 

```
/*
	@author:yiminghe.iteye.com
	v1.0(20090826) 做个可以折叠，展开的panel吧，注意绝对定位与其他定位分别处理。
	v1.1(20090902) 增加alignCollapseBar配置，绝对定位时重新对齐collapsebar，状态查询isExpanded
	
*/

```