Bind ctools modal dynamically
$('area.ctools-use-modal, a.ctools-use-modal').each( function() {
var $this = $(this);
$this.unbind(); // Note the unbind: Otherwise there are multiple bind events which causes issues
$this.click(Drupal.CTools.Modal.clickAjaxLink);
// Create a drupal ajax object
var element_settings = {};
if ($this.attr('href')) {
element_settings.url = $this.attr('href');
element_settings.event = 'click';
element_settings.progress = {
type: 'throbber'
};
}
var base = $this.attr('href');
Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
});