Skip to content

Instantly share code, notes, and snippets.

@jameswilson
Last active March 5, 2021 19:59
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jameswilson/8934896 to your computer and use it in GitHub Desktop.
Save jameswilson/8934896 to your computer and use it in GitHub Desktop.
Drupal Ctools Responsive Modal
/* Override inline dom styles from modal.js */
#modalContent {
position: fixed !important;
top: 12% !important;
bottom: 12% !important;
right: 4% !important;
left: 4% !important;
}
/* Limit max width to 1000px */
div.ctools-modal-content {
width: 100% !important;
margin: 0 auto;
max-width: 1000px;
}
div.ctools-modal-content .modal-content {
width: 100% !important;
}
/**
* Implementes template_preprocess_html().
*/
function mytheme_preprocess_html(&$variables) {
// Override ctools modal.css
$css = drupal_add_css();
foreach($css as $key => $value) {
if (strpos($key, 'ctools/css/modal.css') !== FALSE) {
drupal_add_css(drupal_get_path('theme', 'mytheme') . '/css/responsive-modal.css');
}
}
}
@plusproduit
Copy link

Nice work, thanks!
I would recommend to override the 15px padding in .modal-content to avoid cropped content:

div.ctools-modal-content .modal-content {
width: 100% !important;
padding: 0;
}

@ayalon
Copy link

ayalon commented May 22, 2015

Thanks for the code! This fixed my modal dialogs in a bootstrap theme!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment