Topic: Calling showImage onInitComplete

Hello

I was fan of simpleviewer and bought it few years ago, now it's a pleasure to discover this flash-free version. :-)
Great work guys !

What I want to do is to show the image at a given index when opening gallery. I did this :

    var jb = new juicebox({
        containerId : 'conteneur_juicebox',
        baseUrl : 'albums/' + myAlbumId
    });

    jb.onInitComplete = function(){
        jb.showImage(startupIndex);
    }

What happens is that juicebox gallery is loaded, then the image at startupIndex is correctly displayed but for a very short while before getting replaced by the first image of the gallery.

I could do a dirty trick like waiting a short while before calling jb.showImage(startupIndex);, but like I said this sounds pretty dirty.

Can you explain me what is the problem and how can I get over it. Thanks !

Guillaume


PS: If it can help, this is what's configured in the xml file :

<juiceboxgallery maxImageWidth="1024" maxImageHeight="768" imageQuality="80" thumbWidth="80" thumbHeight="80" thumbQuality="90" useFlickr="false" resizeOnImport="true" cropToFit="false" backgroundColor="rgba(34,34,34,0)" showThumbsButton="true" textColor="rgba(55,127,243,1)" captionBackColor="rgba(255,255,255,0)" imageFrameColor="rgba(255,255,255,0)" thumbFrameColor="rgba(255,255,255,.3)" imageTransitionTime="0.4" showImageOverlay="AUTO" showImageNav="true" thumbsPosition="LEFT" maxThumbColumns="1" maxThumbRows="6" useThumbDots="false" showAutoPlayButton="true" showInfoButton="false" captionHAlign="CENTER" captionPosition="BELOW_IMAGE" enableAutoPlay="true" displayTime="5" autoPlayOnLoad="false" showAutoPlayStatus="false" goNextOnAutoPlay="true" buttonBarPosition="TOP" buttonBarHAlign="RIGHT">

Re: Calling showImage onInitComplete

Can you explain me what is the problem and how can I get over it. Thanks !

Your problem arises because the onInitComplete() event is fired before the first image is displayed and, consequently, your showImage() method is also executed before the first image is displayed.

If you want to specify an image to be displayed first in your gallery, use the firstImageIndex configuration option. (Images are numbered starting at 1).

To link directly to individual images within your gallery, set enableDirectLinks="TRUE" and you can then display, for example, the second image in your gallery by using a URL such as: http://www.example.com/gallery/#2

Descriptions of both firstImageIndex and enableDirectLinks can be found in the General Options section of the 'Config Options' page.

Re: Calling showImage onInitComplete

That's the way to it ! Thanks a lot !! :-)
Good evening to y'all