|
-
Nov 5th, 2009, 09:09 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Get hover status
hi guys, how to get the hover status of a particular element? let's say i got a, b, c, and d links.. how to check which element got an active hover status or has the focus?
is it possible? thank you for any ideas...
The taller the bamboo grows the lower it bends... 
-
Nov 6th, 2009, 06:56 PM
#2
Re: Get hover status
Using jQuery:
Code:
$('a').mouseenter(function(){
// "this" refers to the element that has been entered
});
$('a').focus(function(){
// "this" refers to the element that has been focused
});
$('a').mouseleave(function(){
// "this" refers to the element that has been left
});
$('a').blur(function(){
// "this" refers to the element that has lost focus
});
You can also match elements that currently have a focus or hover:
$('a:hover,a:focus').dowhateveryouwanttodo
-
Nov 11th, 2009, 08:52 AM
#3
Thread Starter
Addicted Member
Re: Get hover status
thanks
The taller the bamboo grows the lower it bends... 
-
Nov 11th, 2009, 09:25 AM
#4
Re: [RESOLVED] Get hover status
Just a further tip that comes to my mind: to keep code simple you could change focus on mouseenter to the element that has been entered. This in turn would mean you only need to do any visual changes in the focus and blur events plus keyboard access would work automatically – tabbing to next element or browser specific stuff, I think Opera has it's own way of handling browsing links. Whether this works for you depends on what you want to do, but it is an alternative idea for keeping code as short and maintainable as possible. jQuery after all does nearly all the cross-browser stuff so you don't need to bother about that
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|