现在的位置: 首页 > 综合 > 正文

jQuery EasyUI API 中文文档 – Documentation 文档

2012年06月04日 ⁄ 综合 ⁄ 共 613字 ⁄ 字号 评论关闭

每个easyui组件都有特性(property)、方法(method)和事件(event),用户可以很容易地扩展它们。

特性

特性在jQuery.fn.{plugin}.defaults里定义。例如, dialog的特性在jQuery.fn.dialog.defaults里定义。

事件

事件(回调函数)也在jQuery.fn.{plugin}.defaults里定义。

方法

方法在jQuery.fn.{plugin}.methods里定义。每个方法有两个参数:jqparam。第一个参数'jq'是必须的,它是指jQuery对象。第二个参数'param' 是指传递给方法的真正的参数。例如,给dialog组件扩展一个名叫'mymove' 的方法,代码看起来就像这样:

1. $.extend($.fn.dialog.methods, {  

2.     mymove: function(jq, newposition){  

3.         return jq.each(function(){  

4.             $(this).dialog('move', newposition);  

5.         });  

6.     }  

7. }); 

现在你可以调用'mymove'方法把dialog移动到一个指定的位置:

1. $('#dd').dialog('mymove', {  

2.     left: 200,  

3.     top: 100  

4. });

抱歉!评论已关闭.