1

I'm working on a module that shows a modal window of some sort (I've used Colorbox so far, but I'm not attached to it) upon page load. I've gotten to the point where I need to make it display on page load and am now a little bit stumped how I'd do that -- any ideas? Using D7, btw.

Thanks!

2 Answers 2

1

I figured it out, it's pretty easy. See below:

function popupmessage_init(){       
    $colorbox_js = 'jQuery(document).ready(function(){ jQuery.colorbox({html: "<h1>Your Message Here</h1>"}); });';
    drupal_add_js($colorbox_js, 'inline');      
}
1
  • 1
    you can even pass extra parameters to style the colorbox window (width, height)
    – NenadP
    Commented Sep 28, 2012 at 6:44
0

I am not quite sure what you need but i use Colorbox extensivly. I even show nodes in pop-up windows, without layout, by sending parameter in url which basically says "use other page layout for this link". It is tricky though, to break from this kind of windows.

For one time popup, i just use cookies, jquery and colorbox in combination.

I found also http://drupal.org/project/popup module very useful for some needs.

Also you have Jquery UI modal http://jqueryui.com/demos/dialog/ .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.