I want to highlight elements with a outline when hovered.
Css -
.hovercss-element-hover {
outline-style: solid !important;
outline-color: red !important;
outline-width: 1px !important;
outline-offset: 0 !important;
outline: 1px solid red !important;
}
Javascript -
$("body").find("*").mouseenter(function(e)
{
e.stopPropagation();
$(this).addClass("hovercss-element-hover");
});
$("body").find("*").mouseleave(function(e)
{
e.stopPropagation();
$(this).removeClass("hovercss-element-hover");
});
This works fine on all the elements except svg. mouseenter seems to fire as outline is visible but mouseleave does not fire and outline never goes away.
Note- I don't want to use css :hover as it does not fit my use case.
Thanks!