属性
所有的属性都定义在jQuery.fn.{plugin}.defaults里面。例如,对话框属性定义在jQuery.fn.dialog.defaults里面。
事件
所有的事件(回调函数)也都定义在jQuery.fn.{plugin}.defaults里面。
方法
调用方法的语法:$('selector').plugin('method', parameter);
解释:
selector 是jQery对象选择器。
plugin 是插件的名称。
method 是相应插件现有的方法。
parameter 是参数对象,可以是一个对象、字符串等。
属性、事件、方法的使用:
$("#dd").draggable({
// 设置属性
handle: '#title',
// 调用事件
onBeforeDrag : function(e) {
console.log("onBeforeDrag!!!");
}
});
// 执行方法
$("#dd").draggable('disable');