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.