Mouseover event doesn't granulate on IE9 for sub elements, event doesn't start on IE8

前端 未结 5 470
被撕碎了的回忆
被撕碎了的回忆 2021-01-02 01:03

We were adapting a method posted here highlight a DOM element on mouse over, like inspect does to NOT use jQuery.

We came up with this solution so fa

5条回答
  •  失恋的感觉
    2021-01-02 01:11

    You could avoid the mouse events being intercepted by the overlay by changing its properties, namely by making it transparent and relying on outline or, with size calculation adjustments, border:

    background:transparent;
    outline:1px dotted red;
    

    Fiddle'd

    Alternatively, you could not rely on an overlay but instead toggle a class on the element itself whenever "moused over". If you cache the reference to it, you could then remove the class when "moused out", rinse, repeat. I'll fiddle with the idea for a little bit more to see how viable it is.

提交回复
热议问题