By guybrush threepwood on
I placed some html in a php variable with
$my_overlay_html_text = '<div id="my_overlay">...</div>';
around it.
then, I add this:
drupal_add_js("(function($, Drupal) {
Drupal.behaviors.request_help_form = {
attach:function() {
$('body').append('$my_overlay_html_text');
$('body').append('<a href=\"?width=500&height=500&inline=true#my_overlay\" class=\"colorbox-inline\">a</a>');
}
}
})(jQuery, Drupal);", 'inline');I then clicked the link and the page reloads, but there is no overlay from the colorbox module.
I have checked the enable colorbox inline box in the configuration menu.
Comments
Add Drupal.attachBehaviors()
Add
Drupal.attachBehaviors()after your second call to $.append().Contact me to contract me for D7 -> D10/11 migrations.
Thanks!
Thanks for the tip. I also found I needed to place a jQuery once command around it so that it made the link only once.