获取悬停时具有样式属性更改的元素的列表

时间:2018-08-05 16:56:50

标签: javascript html css

由于hover事件是TrustedEvent,因此扭转它,尝试对其进行模拟等有点复杂。

我正在寻找一种方法来检测元素悬停时元素的样式属性是否正在更改。

这是一个可以说明基本情况的代码段。

.change-when-hovering:hover {
  color: blue;
}
<p>
  It won't have any style changes, we don't want to console.log the element when hovering
 </p>
<p class="change-when-hovering">
  It will have style changes, we want to console.log this element when hovering BECAUSE his style properties has changed (and not because he has the 'change-when-hovering' class)
</p>

谢谢!

0 个答案:

没有答案