Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1918 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Javascript :

Triggering an element's hover event via another element

Thread title: Triggering an element's hover event via another element
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
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
     


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed