I am digging into Twitter\'s Bootstrap and now want to try and add some functionality to the plugins, but I can\'t figure out how to do so. Using the modal plugin as an exa
For the record there is a simple method to override or extend existing functions:
var _show = $.fn.modal.Constructor.prototype.show;
$.fn.modal.Constructor.prototype.show = function() {
_show.apply(this, arguments);
//Do custom stuff here
};
Doesn't cover custom arguments, but it's easy as well with the method above; instead of using apply
and arguments
, specify the original arguments plus the custom ones in the function definition, then call the original _show
(or whichever it is) with the original arguments, and finally do other stuff with the new arguments.