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... :confused:
Printable View
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... :confused:
Using jQuery:
You can also match elements that currently have a focus or hover: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
});
$('a:hover,a:focus').dowhateveryouwanttodo
thanks :)
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 :)