Pages

Thursday, February 24, 2011

jQuery Plugin - Button

/**
 * This plugin render the button looks like more appealing
 *
 * @type    : jQuery pluggin
 * @author  : irfanudin ridho
 * @email   : irfan.ub@gmail.com
 * @version : 1.0
 * @date    : February 25, 2011
 */

(function($){

$.fn.button = function(){

    $(this).addClass('button');
   
    $(this).mouseover(function(){
        $(this).addClass('button-hover');
    });
   
    $(this).mouseout(function(){
        $(this).removeClass('button-hover');
    });
   
 }
})(jQuery);


This is the css file:
.button { background: #aaf; padding: 5 10px; 
          font: 14px sans-serif; font-weight: bold; 
          color: white; -moz-border-radius: 5px; 
          border: 1px solid #aaf; }
.button-hover { background: #88f; cursor: pointer; }

No comments:

Post a Comment