I'm new to lightbox and I'm amazed how great it is!

A quick question - how could I do something like what www.newsweek.com does on their main page (only a lot simpler). I.e. have a big image and then when I click on it it I could cycle through the images that are image_fields of the nodes from some view (like 'the latest posts'). When I click on 'image details' I would go to the post itself (only I wouldn't want to call it 'image details' - but i guess I could change that in hard code)

any advice is appreciated! thanks!

Comments

stella’s picture

Status: Active » Postponed (maintainer needs more info)

Sorry for the lateness in replying, I've been away for the last month.

You can change "View image details" text in the lightbox2 settings. You may need to upgrade to the latest version of the module (5.x-2.5) - I'm not sure if that feature is available in 5.x-2.3.

Regarding your question about newsweek.com, etc, I would like more information on your set up. Would I be correct in saying the following:

You have a custom content type (cck) node and it can have multiple images assigned to it using image_fields / imagecache. You then have a view of your cck nodes which shows a teaser with one of the images, or something similar. You want to be able to click on the image to view the other images associated with the cck node.

I just need to be clear on what your asking, before I can access whether or not it's possible.

Cheers,
Stella

omnyx’s picture

yes, that sounds about right :)
one more comment - so I know that when I click on one image I should be able to cycle the others (in the popup window).
Is it possible to be able to cycle through without the popup window - i.e. exactly the same what lightbox is doing (with the next and previous arrows) but instead just 'replacing' the original picture (they are all the same size because of imagecache)

just like newsweek.com is doing - to the left there are numbers and upon clicking on them we get the image. They don't really have to be the numbers - left/right arrows would do fine...

thanks!

stella’s picture

Status: Closed (fixed) » Fixed

Right, I've looked into this and currently there's no way I can do this from within the lightbox2 module (unless I get a favourable response to issue #244466: howto define additional field handler functions?).

In the meantime, there is a workaround.

Step 1
You can either apply the patch from #244896: Add incremental classes for multiple value fields in views (still under review, may or may not get committed) or you can override the theme function in your template.php to do the same thing - basically it numbers each of the "field items" so you can uniquely identify an item within a field.

Let me explain further. You have a cck content type which contains an imagefield for which multiple values are allowed. So basically you can attach more than one image to a node. (You could define multiple imagefields, but then this solution won't work.)

In your view, you select your imagefield as one of the fields to be shown in the view and you see the Group multiple values handler. This handler will cause all multiple values (images) to appear within the one row of your view. This results in html that looks something like the following:

<td class="view-field view-field-node-data-field-foo-field-foo-fid">
<div class="field-item">value 1</div>
<div class="field-item">value 2</div>
<div class="field-item">value 3</div>
.......
<div class="field-item">value Y</div>
</td>

There is no way to differentiate between the various values or images using the class name, so the patch mentioned above will change the html output to the following:

<td class="view-field view-field-node-data-field-foo-field-foo-fid">
<div class="field-item field-item-0">value 1</div>
<div class="field-item field-item-1">value 2</div>
<div class="field-item field-item-2">value 3</div>
.......
<div class="field-item field-item-X">value Y</div>
</td>

Step 2
Using the example html output above, you will see that the images are output in a container (td in this case - using table view) with the view-field view-field-node-data-field-foo-field-foo-fid classes. Take the longer second one and in your theme's style.css file add the following:

.view-field-node-data-field-foo-field-foo-fid div.field-item {
  display: none;
}

.view-field-node-data-field-foo-field-foo-fid div.field-item-0 {
  display: inline;
}

The first section hides all the images, while the second one makes the first image in each set visible again. I haven't tested the above css, but it should work with some tweaking.

Cheers,
Stella

stella’s picture

Status: Postponed (maintainer needs more info) » Fixed

Oh it's not possible to cycle through the images without the "popup" - that's what lightbox is. What you're describing might be possible using one of the slideshow modules in Drupal.

Cheers,
Stella

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.