Monday, March 7, 2011

structure of basic jquery plugin

(function($){

//extend jQuery
$.fn.extend({

//name of plugin  'modalWindow'
$(selector).modalWindow(options);

modalWindow: function(options) {
var defaults = {width:'100px',height:'200px'};

//Iterate over the current set of matched elements
return this.each(function() {

//define closure for each element on which code is called

var opt = options;
//code to be inserted here
});
}})})(jQuery);

No comments :

Post a Comment