1 (edited by dsTony 2018-11-21 18:22:40)

Topic: onInitComplete function not triggered on mobile

After some basic testing, the jb.onInitComplete function does not appear to trigger on smaller screen devices that trigger the mobile gallery view.

For an example, check out: https://www.dstestblog.com/tony-clean/idx/mls-1381735- from both a desktop view and mobile device (browser emulated mobile device would be best, to be able to see the console).

Here's the function:

<script type="text/javascript">
    jQuery(document).ready( function() {
        jb = new juicebox({
            containerid: 'dsidx-media',
            galleryWidth: '100%',
            galleryHeight: '100%',
            configUrl: dsidx.details.GetConfigUrl(),
            themeUrl: 'https://api-idx.diversesolutions.com/Styles/Libraries/juicebox/theme.css',

            enableAutoplay: 'true',
            showautoplaybutton: false,
            autoPlayOnLoad: true,
            galleryTitlePosition: 'NONE',
            showImageOverlay: 'auto',
            thumbHeight: '60',
            thumbWidth: '60',
            thumbSelectedFrameWidth: '5',
            captionPosition: 'NONE',
            expandInNewPage: 'false',
            backgroundColor: 'transparent',
            imageScaleMode: 'SCALE_DOWN'
        });
        jb.onInitComplete = function(){
        console.log('woof');
            if(jb.getImageCount() <= 1){
                jb.toggleThumbs();
            }
        }
        jb.onExpand = function(){
            dsidx.details.trackGalleryExpand();
        }
    });
</script>

As you can see, we have a console.log('woof'); in there, which on desktop, works: http://prntscr.com/ll9fhx

However, when emulating a mobile view, the jb.onInitComplete and the console.log (along with everything else) aren't triggered: http://prntscr.com/ll9g6m

Is there a reason for this? Currently the JuiceBox version that's in use is Juicebox-Pro 1.2.0, I have not tried with the current 1.5.1 Lite.

Am I missing something here, or is this an existing JuiceBox bug? Everything else appears to be functioning correctly.

Re: onInitComplete function not triggered on mobile

I have tried with the current 1.5.1 Lite version, and it does appear to work there. So it looks like that this is a bug that existed in 1.2.0. We will have to see about updating, since what we're using is ~6 years old at this point.

Re: onInitComplete function not triggered on mobile

Thank you for posting the update to your problem.
Hopefully you'll get on OK with the latest version (v1.5.1).

You can upgrade an online gallery by replacing the gallery's existing 'jbcore' folder with the 'jbcore' folder from the Juicebox-Pro v1.5.1 zip package ('juicebox_pro_1.5.1/web/jbcore').
Full instructions for upgrading JuiceboxBuilder and existing galleries can be found on the Upgrading Juicebox support page.

If you encounter any further problems, please post back and I'll investigate further.
Thank you.