noob: question about hover();

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

noob: question about hover();

Rizky
Hello list, this is my first post, and I have a (dumb) question for you all.

can you look at this code below for a while? I'm trying to recreate a simple css effect using jQuery so it can work in IE ( foo:hover ) and foo here is not an "a" element. and surely you all know IE can only accepts :hover pseudo-classes on links :D

$(document).ready(function() {
    /* foo:hover effect */
    $("div.content").hover(
        function() { $(this).find("a").adClass("hilite"); },
        function() { $(this).find("a").removeClass("hilite"); }
    );
});



if I use css it would be something like this.

.content:hover a { color: #036; }

so when the mouse is on mouseover at the div.content all the a's inside it would change colours. well, I know this sound simple, but I'm no javascript expert. so can anyone help me? thanks a lot..


regards,
Rizky

_______________________________________________
jQuery mailing list
[hidden email]
http://jquery.com/discuss/
Reply | Threaded
Open this post in threaded view
|

Re: noob: question about hover();

Jack Shedd
Try .addClass instead of .adClass

On Jun 6, 2006, at 6:12 AM, Rizky wrote:

> Hello list, this is my first post, and I have a (dumb) question for  
> you all.
>
> can you look at this code below for a while? I'm trying to recreate  
> a simple css effect using jQuery so it can work in IE ( foo:hover )  
> and foo here is not an "a" element. and surely you all know IE can  
> only accepts :hover pseudo-classes on links :D
>
> $(document).ready(function() {
>     /* foo:hover effect */
>     $("div.content").hover(
>         function() { $(this).find("a").adClass("hilite"); },
>         function() { $(this).find("a").removeClass("hilite"); }
>     );
> });
>
>
> if I use css it would be something like this.
>
> .content:hover a { color: #036; }
>
> so when the mouse is on mouseover at the div.content all the a's  
> inside it would change colours. well, I know this sound simple, but  
> I'm no javascript expert. so can anyone help me? thanks a lot..
>
>
> regards,
> Rizky
> _______________________________________________
> jQuery mailing list
> [hidden email]
> http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
[hidden email]
http://jquery.com/discuss/
Reply | Threaded
Open this post in threaded view
|

Re: noob: question about hover();

Dean Edwards
On 06/06/06, Jack Shedd <[hidden email]> wrote:
> Try .addClass instead of .adClass
>

Good catch. ;-)

_______________________________________________
jQuery mailing list
[hidden email]
http://jquery.com/discuss/