$("p").hover(function(){
  $(this).addClass("hover");
},function(){
  $(this).removeClass("hover");
});

this is kind of a verbose way of swapping classes, isn't it?

I imagine it would not add much to the lightweightness of jquery if it
allowed something like:

$("p").hoverSwap("hover");

or, if more versatility is desired, perhaps something like:

$("p").swapClass("hover", "click"); // hover is class name and click
is the event name

I can use my own extension I suppose, but then again, swapping classes
on hover and click seems like such an often-used functionality it
might just warrant inclusion into the library...


just an idea...

Reply via email to