Each easyui component has properties, methods, and events, which can be easily extended.
Features
The features are defined in jQuery. fn. {plugin}. defaults. For example, the dialog feature is defined in jQuery. fn. dialog. defaults.
Event
The event (callback function) is also defined in jQuery. fn. {plugin}. defaults.
Method
The method is defined in jQuery. fn. {plugin}. methods. Each method has two parameters: jq and param. The first parameter 'jq' is required. It refers to the jQuery object. The second parameter 'param' refers to the real parameter passed to the method. For example, to extend a method named 'mymove 'to the dialog component, the code looks like this:
Copy codeThe Code is as follows:
$. Extend ($. fn. dialog. methods ,{
Mymove: function (jq, newposition ){
Return jq. each (function (){
$ (This). dialog ('move ', newposition );
});
}
});
Now you can call the 'mymove 'method to move the dialog to a specified position:
Copy codeThe Code is as follows:
$ ('# Dd'). dialog ('mymove ',{
Left: 200,
Maximum: 100
});