February 2010
Beginner
400 pages
11h 13m
English
You can add your own functions to the jQuery library. For example, to create a simple function that will pop up an alert box, you can do so with the following code:
//don't use $ alias in case user overrides it
jQuery.fn.say = function (message) {
alert("jQuery says " + message);
return this;
}
You can then call the new function with the following code:
$.fn.say("hello").say("good bye");
And there is, of course, no reason why you couldn't write a new effects function and use it as part of a chain of effects.
For more information, please refer to http://docs.jquery.com/Plugins/Authoring.