Created
June 13, 2010 15:39
-
-
Save rmurphey/436754 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.myPlugin = function(args) { | |
// set defaults for the plugin | |
var defaults = { | |
foo : 'bar' | |
}, | |
// override those defaults with user-provided args | |
settings = $.extend(defaults, args), | |
// define functions for stuff you'll do a lot | |
myFunction = function() { | |
// do stuff | |
}; | |
// return the element(s) the plugin was called on, | |
// after doing stuff to them | |
return this.each(function() { | |
// you can use any of the variables you defined above here | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment