Forum Moderators: open

Message Too Old, No Replies

:hover not being applied to new elements

MSIE6; elements being added below mouse, :hover not firing

         

vincevincevince

10:15 am on Oct 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm using CSS hover on a particular A element; it works fine when I move mouse over it.

The element is added through the DOM (think AJAX) and is placed directly under the mouse pointer. This means that the mouse did not move; but there is a :hover-capable element beneath it which should be in 'hover' state.

Unfortunately it is not :hover-ed. It works fine in FF and Opera, but not in IE6.

Any ideas or pointers on how I can get the :hover to be applied? Any commands which basically say 'go back and have another check if yon mouse be over something'?

HOTmike

11:14 pm on Oct 30, 2007 (gmt 0)

10+ Year Member



A thought (or, more like a messy hack):
I'm guessing you have a function or event to generate your anchor element under the mouse, meaning you know exactly where in your script you run into thi issue. Try firing a mousemove event after generating your anchor element, or simply script a mouse move (1 px in any direction, and back again). This should be enough to a:hover your element without costing a lot of needless code execution.

vincevincevince

6:00 am on Nov 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Giving it a go, thanks.