mutation observers - Catching a CSS change with jQuery -
what want find out when css value has been changed element through css. let's background-color has been changed else. example using :hover.
at first thought mutation observer resolve wrong. when there's change style of element inside css file doesn't affect style attribute element. example, let's have element id "test":
$('#button').click(function () { $('#test').css('backgroundcolor', 'blue'); });
this being detected mutation observer style change.
however doing in css file doesn't trigger event:
#test:hover { background-color: blue; }
so asking - there way find out, preferably using jquery, when change has been made in css file element?
no, unfortunately not (unless changed javascript - it's not in case).
the thing left specify why you're wanting this, , maybe there'll way of meeting requirements in different way. may falling victim xy problem here:
https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem
note: obviously, use of constant polling of background-color
of element can achieve degree of accuracy (depends on frequency of check), wouldn't advise .
Comments
Post a Comment