On my front page, is it possible to call thickbox with some code, as in automatically, not as a class to an link? I'm trying to put a splash page in thickbox. I'm aware the splash module does this, but the code is incredibly buggy.

Thanks!

Comments

frjo’s picture

You would need to write some custom jQuery (JavaScript) code to do this.

I would also suggest checking out the Colorbox, http://drupal.org/project/colorbox, module as a a more modern replacement for Thickbox.

When Colorbox has a stable release I will start actively recommend people to switch/upgrade from Thickbox to Colorbox. I'm the maintainer of Thickbox and a co-maintainer of Colorbox.

rc2020’s picture

Interesting...do you have an example jquery code to launch the modal? I'm pretty good w/ php I just know zero js/jquery. I don't mind using either colorbox/thickbox I just need to load it as a splash/welcome message.

Thanks!

frjo’s picture

You have this from thickbox.js:

// Initialize Thickbox.
Drupal.behaviors.initThickbox = function (context) {
  $('a,area,input', context).filter('.thickbox:not(.initThickbox-processed)').addClass('initThickbox-processed').click(function() {
    var t = this.title || this.name || null;
    var a = this.href || this.alt;
    var g = this.rel || false;
    tb_show(t,a,g);
    this.blur();
    return false;
  });
};

Change the name, make it activate on the class/id that suit your needs and replace "click" with "load", or something like that.

I recommend you do this with Colorbox instead, you fins a similar function in "js/colorbox.js".

Thickbox will have no D7 version, Colorbox will be the recommended upgrade path.

rc2020’s picture

Awesome, Thanks!