Date Added: 14/01/2015

dd
</pre>
(function ( $ ) {

 $.fn.greenify = function( options ) {

 // This is the easiest way to have default options.
 var settings = $.extend({
 // These are the defaults.
 color: "#556b2f",
 backgroundColor: "white"
 }, options );

 // Greenify the collection based on the settings variable.
 return this.css({
 color: settings.color,
 backgroundColor: settings.backgroundColor
 });

 };

}( jQuery ));
<pre>

code plugin expect an option   this in function represents  "$(selector)"
usage:   $("div").greenify({font-size:12px});
if want to  any other function for  chaining in plugin function return this;
  $("div").greenify({font-size:12px}).any_function();

Last Update: Posted by: müslüm ÇEN
Not Commented Yet !
Please login in order to comment . Login