Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.
0 votes
Hey Justin,

I was wondering if it's possible to open MSO slideshows in a lightbox instead of keeping them on the page?
Should be similar to the thumbnail functionality you have in the code - right?

As this currently isn't exposed in InDesign - could I base it on object names? So for example any MSO named slideshow_* will open in a lightbox instead?

I'm desperate for a point to get started - but I'm not afraid to use custom JS to do it. ;)
Can you give me/the community a hint?

I'm quite sure this would come in really handy for a lot of things - especially since it's much closer to the way iOS would handle it natively.

Right now we are struggling with 2 potentially contradicting ways to navigate (slideshow vs. slider navigation) and I think a lightbox would be the perfect way to defuse this.


in how_to by (230 points)

1 Answer

0 votes
Best answer

Hi Mike,

First make sure that you check one of the lightbox options in the dialog, so that the Lightbox library is included with the output.

Here's the Lightbox used within in5 output: http://www.jacklmoore.com/colorbox/

The main question is: how do you want to trigger the Lightbox? 1) By click on the MSO, or 2) by a separate button.

Let's start with clicking the MSO, because that will probably be simpler.

Since the MSO is already in the HTML, it will be considered an inline object.

The code might look something like this:

$(document).ready(function(){ /*make sure the doc is available first*/
   $(".slideshow").click(function(){ /*add a click event to all slideshows*/
     $.colorbox({inline:true, href:$(this)});

     return false; /*optional: prevent other touch events from being triggered on the slideshow*/



I'm not sure if all of the interactivity of the slideshow will carry-through to the Lightbox, but you can give it a try.

by (197k points)
selected by
Oops, I just noticed I never thanked you for pointing me in the right direction. It turned out to be a little more complex than that (of course!) but I eventually got it working really nicely.
I might also want to look into passing the click event from a separate button onto the MSO but for now it's fine.

The only trouble is that my custom code breaks when updating from 2.2.0 to 2.2.5. Will hopefully be able to set up a reproduction document and send it over this week.


Thanks for the follow up, Mike. :-)