When using Lightbox2 in image gallery settings you may want a "Start Slideshow" link to appear at the top of the image gallery. Normally this isn't a problem as you can just add a link, with a Lightbox rel attribute, to the first image in the gallery. However, with dynamically created content, such as that created by Views, it's impossible to know the path of the first image. The following link will provide this feature for you:
<a href="#" onclick="Lightbox.triggerLightbox('lightshow', 'groupname');">Start Slideshow</a>
The first parameter to triggerLightbox() is the rel
attribute in use on the images. The second param is optional and is the name of the group you are using to make your image sets. If the content is generated automatically, you may need to view the page source to determine this group name.
If you use the Image module so that every image is one node, then use 'node_images' as the groupname.
For Views, the rel grouping is determined partially by your settings under the "CCK display settings" section on admin/settings/lightbox2. For example, if you configure lightbox2 to group imagefields by just their field name and your imagefield has a machine-readable name of "field_testimage", then you should call Lightbox.triggerLightbox('lightshow', 'field_testimage');
.
Note, if you're entering this link with an onclick
attribute, you will need to use the "Full HTML" input format. For security reasons, it is recommended that you don't allow untrusted users on your site access to this input format.
Comments
Images as nodes
If you use the Image module so that every image is one node.
You should use 'node_images' as groupname
Lightbox onclick anchor causes page to scroll to top (redisplay)
The onclick anchor will cause the page to redisplay unless the event returns false.
Alternately we can use JavaScript:void(0); as the anchor target.
Autostart
It works for me. Is there any way to make the link automatically start the slideshow even if this is disabled in the normal lightbox view?
This does not work for me, I
This does not work for me, I keep getting "Lighbox is not defined". What am I missing?
JCL
Hi, for me works this
Hi,
for me works this solution. I hope it will be helpfull for someone
Really helpful
Thank You!