Skip to content

Instantly share code, notes, and snippets.

@Quilted
Last active November 1, 2017 20:14
Show Gist options
  • Save Quilted/13af94eb02daf14d23ab to your computer and use it in GitHub Desktop.
Save Quilted/13af94eb02daf14d23ab to your computer and use it in GitHub Desktop.
Omega 4 media query and breakpoints files
<?php
/**
* Implements hook_preprocess_html().
*/
function THEMENAME.preprocess_html(&$variables) {
// Load the matchMedia polyfill.
if (module_exists('picture') && drupal_get_library('picture', 'matchmedia')) {
$options = array('group' => 'THEMENAME');
// Load the mediaquery behavior from Omega. This allows registering media
// queries via Drupal.settings to automatically print body classes based on
// whether or not they currently apply.
$omega = drupal_get_path('theme', 'omega');
drupal_add_js("$omega/js/omega.mediaqueries.js", $options);
// Register the media queries. The array keys will be used to compose the body
// class names and the values are the actual media queries.
drupal_add_js(array('omega' => array('mediaQueries' => array(
'mobile' => 'all',
'narrow' => 'all and (min-width: 740px)',
'normal' => 'all and (min-width: 980px)',
'wide' => 'all and (min-width: 1220px)',
))), 'setting');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment