/ Published in: JavaScript
Pretty straight forward. Replace 'PLUGIN_NAME' with the name of your plugin, add your code in the appropriate places, test and deploy.
Should be pretty easy to use, I commented it heavily.
Should be pretty easy to use, I commented it heavily.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Create Closure (function($) { $.fn.PLUGIN_NAME = function(options) { // Extend the defaults, over-writing them with anything passed by the caller var opts = $.extend({}, $.fn.PLUGIN_NAME.defaults, options); // Iterate over each element return this.each(function() { $this = $(this); // Allow for use of the Metadata plugin var o = $.meta ? $.extend({}, opts, $this.data()) : opts; // YOUR CODE GOES HERE }); }; // Additional methods follow the format: // $.fn.PLUGIN_NAME.format = function(txt) { // FUNCTION STUFF GOES HERE // }; // Plugin Defaults $.fn.PLUGIN_NAME.defaults = { }; })(jQuery); // Closure Closed