Created
April 18, 2012 12:47
-
-
Save kasperg/2413373 to your computer and use it in GitHub Desktop.
Drupal CTools Modal sizing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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