HoverClass jQuery Plug

. 6/28/10
  • Agregar a Technorati
  • Agregar a Del.icio.us
  • Agregar a DiggIt!
  • Agregar a Yahoo!
  • Agregar a Google
  • Agregar a Meneame
  • Agregar a Furl
  • Agregar a Reddit
  • Agregar a Magnolia
  • Agregar a Blinklist
  • Agregar a Blogmarks


HTML

<div id="toHover">Example, hover this area</div>


CSS

table { border-collapse: collapse; empty-cells: show; }
td, th { border: 1px solid #FFFFFF; padding: 4px; font-size: 1em; }
p { font-size: 1.2em; line-height: 1.5em;}
div {padding: 4px; border: 1px solid #f00; background-color: #fdd; }
.aHover { background-color: transparent; cursor:pointer; }


Javascript

$(document).ready(function(){
   $("div").hoverClass("aHover");
   $("address.email").each(function(){

    $(this).html("<a href=\"mailto:" + this.title.replace(/( \[at\] )/g, "@").replace(/( \[(dot|period)\] )/g, ".").replace(/( \[dash\] )/g, "-") + "?subject=Question%20Regarding%20" + escape($("title").html()) + "\" title=\"Send " + $(this).html() + " an email regarding " + $("title").html() + "\">" + $(this).html() + "<\/a>");

    this.setAttribute("title", "");

    });

    });

    $.fn.hoverClass = function(c) {

    return this.each(function(){

    $(this).hover( 

    function() { $(this).addClass(c); },

    function() { $(this).removeClass(c); }

    );

    });

    };


View Example


0 comments: