Skip to content

Instantly share code, notes, and snippets.

@kasperg
Created April 18, 2012 12:47
Show Gist options
  • Save kasperg/2413373 to your computer and use it in GitHub Desktop.
Save kasperg/2413373 to your computer and use it in GitHub Desktop.
Drupal CTools Modal sizing
(function($) {
/**
* For this approach to work we need our click handler to trigger before
* the CTools modal handler. This is currently handled by setting the weight
* when including this file.
*/
Drupal.behaviors.setCtoolsModalSize = {
attach: function(context, settings) {
$('a.ctools-use-modal').once('modal-size', function() {
$(this).click(function() {
Drupal.settings.CToolsModal.modalSize.width = $(this).data('modal-width');
Drupal.settings.CToolsModal.modalSize.height = $(this).data('modal-height');
});
}
});
}
}
Drupal.behaviors.aBehavior = {
attach: function(context, settings) {
$('a.class1').data('modal-width', 100).data('modal-height', 100);
}
}
Drupal.behaviors.someBehavior = {
attach: function(context, settings) {
$('a.class2').data('modal-width', 200).data('modal-height', 200);
}
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment