Project:Exhibit
Version:6.x-1.0-beta1
Component:JavaScript
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:exhibit, lightbox

Issue Summary

Hi,

I cannot figure out for the life of me how to get lightbox to work inside of a drupal based exhibit. I have done the same using a plain html page with:

<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>

and

<a ex:href-content=".example_1" rel="lightbox"><img ex:src-content=".example" /></a>

which works like a charm. Can anyone shed some light on how I can apply this to a drupal exhibit?

Thanks
7

Comments

#1

7wonders:

Try thickbox instead - it works. I have used the Exhibit lens and have used thickbox within lens to get the thickbox popup from exhibit data.

- Rajeev

#2

You've done it in Drupal? I spent all day yesterday trying to get title links to open with thickbox, greybox and lightbox in Exhibit/Drupal and it just didn't want to work.

#3

Hi, checking in for any updates:

1) You can customize the format under View and Lightbox does show up as an option. However, I didn't get the Lightbox format to work on my site (it doesn't open to a Lightbox). It has, however, allowed me to chose the image cache set up and link it to the node without making any changes to the Exhibit Feed code.

2) If this Lightbox option work, it would be a roundabout option to addresses the issue (https://drupal.org/node/488174); opening the link in Lightbox will allow user to "maintain" their facet search state without sending them to a new page (or user can manually right-click open to new window...but for most, this isn't an option).

Bonal

AttachmentSize
Exhibit-Format-Lightbox.jpg 43.89 KB

#4

Lightbox can work with Exhibit. You have to use Drupal Behaviors. Lightbox needs to process the DOM after it's generated, which can be tricky since Exhibit alters the DOM dynamically after the page loads. For me, I simply ran Drupal.attachBehaviors() once the Exhibit view, or whatever part of the DOM tree, is generated.

Below is code to run Drupal.attachBehaviors() once the Exhibit TabularView gets created. You should be able to do something similar for other Exhibit views. I have links in the Tabular View that open up external pages in Lightbox. You can probably focus the behaviors to specific sections of the DOM/page but I haven't tried that. This seems to run fast enough.

var oldTabularViewReconstruct = Exhibit.TabularView.prototype._reconstruct;
Exhibit.TabularView.prototype._reconstruct = function() {
oldTabularViewReconstruct.call(this);
Drupal.attachBehaviors();
};

#5

This sounds promising, thanks a lot! Where do you place this block of code at?

#6

Anywhere on your page. Just put it inside [script type="text/javascript"]
tags. You'll need to allow Full HTML for that text area (recommended) to allow script tags to pass through or hard-code it into your (file-based or contemplate-based) template (not recommended.)

#7