GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Saturday, February 19, 2011

Plugin Authoring

<script src="jquery-1.5.js"></script>

<h1 id="satu">We hope we can do more!</h1>

<script>

(function($){

    // coloring the text
     $.fn.coloring = function(options){

          var settings = {
               'color' : 'blue'
          };

          if(options){
               $.extend(settings, options);
          }

          $(this).css('color',settings.color);

          return $(this);
     }


      // backgrouning the text
     $.fn.backgrouning = function(options){

          var settings = {
               'background': '#fc5',
          };

          if(options){
               $.extend(settings, options);
          }

          $(this).css('background-color', settings.background);

          return $(this);
     };


    // sizing the text
     $.fn.sizing = function(options){

          var settings = {
               'size': 30,
          };

          if(options){
               $.extend(settings, options);
          }

          $(this).css('font-size', settings.size);

          return $(this);
     };

})(jQuery);

$('#satu').coloring().backgrouning().sizing()

</script>

Share/Bookmark

No comments:

Post a Comment