杨的空间
业精于勤,荒于嬉,行成于思,毁于随

导航

<2007年11月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
统计
  • 随笔 - 67
  • 文章 - 13
  • 评论 - 60
  • 引用 - 0

常用链接

留言簿(6)

随笔分类

随笔档案

文章分类

相册

WEB开发相关

其它链接

  • 你所不知道的牛奶的缺点
  • 喝牛奶要特别注意的一些知识
  • 旁观者的Blog (rss)
  • 参与移动增值业务平台开发这些年来,不断地遇到新领域新知识点,屡屡感受到新进入者的迷惑和彷徨,所以对遇到的每一个问题都详细记录问题现象、解决思路以及解决方案,并在blog中留下印迹,以备他日有心人google之而知之。你们的新手之痛,你们的新业务发展之初的思路混沌,我都感同身受,所以欢迎和我一起探讨这些话题,诸如IVR/SMS/MMS/WAP/Podcast/SIP/JavaME/Web2.0等等,知无不言言无不尽。

搜索

  •  

最新评论

阅读排行榜

评论排行榜

 

I love using Scriptaculous for its effects and drag/drop. However, I need to have my DIVs be resizable too. To make this happen, I’ve written a class called Resizeable that can be added to a DIV in the same way that Draggable can be.

This code is standalone (it needs Prototype, but not Scriptaculous), and it can be used with Draggable with one note: The Draggable handle cannot be the element that is Resizeable, you must specify a handle element when you create a Draggable to avoid confusion between Draggable and Resizeable.

This doesn’t work very well
...
...
new Draggable(‘foo’); new Resizeable(‘foo’);
...
...

This works nicely:
...
...

new Draggable(‘foo’, {handle: ‘bar’}); new Resizeable(‘foo’);

There aren’t many options for this object, but here they are:

The grab areas can be defined with top, left, bottom, right. Each defaults to 6 pixels. If you set this to 0 (zero), then resize in that direction will be disabled.
...
...

new Resizeable(‘foo’, {top: 0, left:50} );

A callback function can be defined that will be called when the resize is over.
...
...

new Resizeable(‘foo’, {resize: function(el) { alert(‘Done!’); } } );

The minimum height and width of the DIV can be specified as minHeight and minWidth options.

The resizable code in action – view source to see how it works.

The Javascript source file can be downloaded here

Currently, this code doesn’t quite work in IE (the DIV can jiggle around a little), but Firefox 1.0 is working Ok.


 

出处:http://blog.craz8.com/articles/2005/12/01/make-your-divs-resizeable

posted on 2007-12-01 10:32 阅读(473) 评论(0)  编辑 收藏 引用 所属分类: 技术类
只有注册用户登录后才能发表评论。