Skip to content

Instantly share code, notes, and snippets.

@glesica
Created December 9, 2011 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glesica/1449693 to your computer and use it in GitHub Desktop.
Save glesica/1449693 to your computer and use it in GitHub Desktop.
jquery plugin magic
$.fn.orderly = function(method, options) {
// Decide which method we're supposed to call and call it
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || ! method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.orderly');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment