Thank you for cleaning that up,  but it's still not quite right.

It's not fading in, it just adds the class instantly. and when it
fades out, it removes the div I put the .hover class on.

Thanks for trying.

On Oct 24, 8:03 pm, ricardobeat <[EMAIL PROTECTED]> wrote:
> $(document).ready(function() {
>
>         $('.button').hover(function() {
>              $(this).addClass('hover').fadeIn();
>         }, function() {
>              $(this).removeClass('hover').fadeOut();
>         });
>
> });
>
> This should work, it's exactly the same as your second try but with
> correct syntax.
>
> On Oct 24, 11:54 pm, gerbert <[EMAIL PROTECTED]> wrote:
>
> > Hi, I'm new to this group and to jQuery and javascript in general. I
> > would like to learn how to use hover with a fade. I can do each
> > separately but am having a hard time chaining them. Here's my best
> > attempts at a simple hover button with a fadeIn and FadeOut:
>
> > $(document).ready(function() {
> >         $('.button').hover(function() {
> >     $(this).fadeIn(1000,$('.button').addClass('hover'));
> >   }, function() {
> >     $(this).fadeOut(1000,$('.button').removeClass('hover'));
> >   });
>
> > });
>
> > That didn't work. Nor did this:
>
> > $(document).ready(function() {
> >         $('.button').hover(function() {
> >     $(this).addClass('hover').fadeIn(1000);
> >   }, function() {
> >     $(this).removeClass('hover'.fadeOut(1000));
> >   });
>
> > });
>
> > If anybody can help me out I'd be stoked. I've spent too much time on
> > this seemingly simple effect. Thanks.

Reply via email to