Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fire event if the CSS style is changed by the user?

I'm writing a lightweight htc program for IE 9 (Javascript). CSS3 has a new property called transition, but it doesn't work in IE 9. I'm trying to implement this, but I need to know when a property changes. I'm familiar with DOMAttrModified and onpropertychange, but they don't trigger if CSS changes the property:

a {
color:#FFF;
}

a:hover {
color:#000;
}

If you mouseover an anchor, DOMAttrModified doesn't do anything. I could use mouseover, mouseout, blur, focus, activate and deactivate and check every time they occur if a property changed, but what if:

div:hover a {
color:#FFF;
}

The user didn't hover the anchor tag, but CSS changed the color anyway. I think pie.htc has the same problem. I only need a solution compatible with IE 9...

like image 966
bopjesvla Avatar asked Jul 19 '11 14:07

bopjesvla


1 Answers

I don't think there's an event for "onCSSChange"

How about running a subroutine every 50 ms and checking the current styling. If the CSS changes, you can fire your own event.

like image 196
Jeff Avatar answered Oct 02 '22 01:10

Jeff