I have to create a document that provides a "model" for how to write jQuery plugins for a large site.
For example: all plugins should have:
$.fn.somePlugin = function() {
return this.each(function() {
// Here the plugins does its goal.
});
};
so they respect the fluent model and also they can be called with multiple elements at same time. Some other things I think they should all have are:
How would it be your "Model Plugin"? (achieving this and some other things you think necessary in the best possible way).
Result
Here you can see my plugin template based on all the information I read.
The jquery docs have a section on plugin authoring: http://docs.jquery.com/Plugins/Authoring
and here's the "slides" from ben almans talk on plugin authoring from the boston jquery conference:
https://github.com/cowboy/talks/blob/master/jquery-plugin-authoring.js
and one more link from ben alman about writing plugins.
http://msdn.microsoft.com/en-us/scriptjunkie/ff696759
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With