JoshBarr / on-media-query

A neat way to trigger JS when media queries change. No jQuery required.
283 stars 33 forks source link

Doesn't seem to work in Opera (or Opera Mobile) #20

Open thany opened 11 years ago

thany commented 11 years ago

It works in neither Opera on the desktop, Opera Mobile (different one), or Opera Mobile on desktop (oh yeah, there's that too).

Quite possibly, because finding the font-family for the html element in Opera always returns the resolved font-family, and a family like "small" or "medium", as is common practise in this scenario, doesn't exist and reverts to whatever font is default for the browser. In Android that would be Roboto, on desktop (Windows) its Times New Roman.

Is there a way to tell Opera to fetch the declared font-family for an element? Then that would fix it for Opera (for desktop / for Android / Mobile).

/edit Removed mentioning Opera for Android. Works fine there.

codekipple commented 11 years ago

I think this fork https://github.com/registerguard/js-media-queries works on opera. I think it works because it tries using both the font-family and pseudo content.

So for this repo to support opera it would have to take a similar approach.