Check out a free preview of the full jQuery Plugins and jQuery UI course:
The "Extending Plugins" Lesson is part of the full, jQuery Plugins and jQuery UI course featured in this preview video. Here's what you'd learn in this lesson:
Extending plugins becomes useful when a plugin already exists and you want to increase its functionality using jQuery’s built-in “position” plugin. The built-in “position” plugin is set to only return information - you can make it pass left and top by using the “proxying” function. Proxying the function works anywhere you can store off a reference to the original function and is not unique to jQuery. Define a new position method by deciding on your parameter and set the values and the context to the jQuery object, not globally. Note: Call is used to discern if the position is set correctly by calling the original scope to see if default functionality still works. Easily extend plugins by proxying existing plugins and pass the new functionality. Store the old function into global variable instead of position_old =fn.position, as it leaves the referenced function open this way.