Hi
Apologies if this has been covered else where I did have a quick look but couldn't see anything. In Omega 3 it appended classes to the body to let you know what breakpoint you are on. I suppose this was possible as the breakpoints are predefined in the admin screen.
This functionality doesn't appear to be in Omega 4 (I'm guessing partly because you define your own breakpoints within the css). The problem is though if in my case you want to do some specific javascript at different breakpoints. E.g. on mobile I want a sub menu to toggle when clicked and on desktop to toggle on hover, is that possible in Omega 4? Or would it mean having 2 duplicates of a menu simply to do this small javascript change?
Comments
Comment #1
fubhy CreditAttribution: fubhy commentedYes, this functionality exists.
It already exists in beta3 but I just commited some improvements that make it more usable. Also, at this point you should use 4.x-dev as it has all the latest bug fixes (no regressions at this point).
Anyways. Take a look at omega/js/jquery.matchmedia.js (minified version available at omega/js/jquery.matchmedia.js).
After loading that .js file you can provide media queries to which you want to listen by passing them into Drupal.settings via drupal_add_js().
Example:
You can also (and should, if possible) put that in #attached obviously.
Anyways... This will give you the 'foo-active' / 'foo-inactive' classes on the body tag.
Make sure you are using 4.x-dev for the Drupal.settings to work.
Comment #2
fubhy CreditAttribution: fubhy commentedOh, but in any case you should always try to avoid relying on js for media query detection. It's slow(er) (compared to plain CSS media queries) and, well, depends on JS.