Let's slow down a little.  I think this might be much easier than you
imagine.
Let's go over the requirements.

1. You have different shaped buttons.
2. Each button has a "hover".
3. You want to add all the hover handlers using jQuery.

Does this sound correct?  Add to this list, but keep it straightforward.
Can you post some of the other sized button images?

I think I could help whip this up pretty quickly.

Glen


On Dec 4, 2007 6:43 PM, DaveG <[EMAIL PROTECTED]> wrote:

>
> A slightly better working version:
> jQuery(document).ready(function() {
>    jQuery("[EMAIL PROTECTED]'sprite-hover-']").hover(
>       function(){
>          jQuery(this).addClass(
> this.className.replace(/sprite-hover-(\w+)-off/gi, 'sprite-hover-$1-on')
> );
> //         jQuery(this).attr('class',
> this.className.replace(/sprite-hover-(\w+)-off/gi, 'sprite-hover-$1-on')
> );
>       },
>       function(){
>          jQuery(this).removeClass(
> this.className.match(/sprite-hover-(\w+)-on/gi) );
> //         jQuery(this).attr('class',
> this.className.replace(/sprite-hover-(\w+)-on/gi, 'sprite-hover-$1-off')
> );
>       }
>    );
> });
>
> This adds/removes a class. My guess is that replacing the entire class
> is causing the hover event to retrigger for some reason, whereas adding
> replacing classes does not.
>
>  ~ ~ Dave
>

Reply via email to