View Single Post
08-06-2010, 02:54 AM
#1
Gaz is offline Gaz
Gaz's Avatar
Status: Request a custom title
Join date: Apr 2007
Location: UK
Expertise: Code & Programming
Software: Coda, TextMate, Sublime 2
 
Posts: 2,097
iTrader: 26 / 100%
 

Gaz will become famous soon enough Gaz will become famous soon enough

Send a message via Skype™ to Gaz

  Old  Triggering an element's hover event via another element

Hey all,

I'm sure there's a really simple solution to this, but I'm a bit stuck. Basically I have this HTML:

HTML Code:
<div class="forum">
<h3><a href="#">Forum Title</a></h3>
<p>Some Description</p>
</div>
I have then implemented the following JS/jQuery:

Code:
$(document).ready(function(){

    $(".forum").click(function(){
          window.location=$(this).find("a").attr("href"); return false;
    });
            
});
This works as planned: If I hover over anywhere in the containing .forum div it will find the link inside and send the browser to the href's value. However, is there a way I can trigger the <a> hover state (a:hover) causing it to change colour (defined in my css) when my cursor hover over the .forum div (not specifically the link)? It only is triggered if I hover my cursor directly over the link itself, which is the normal behaviour, of course.

Many thanks in advance.

Reply With Quote