1 (edited by RupertSnigg 2019-01-13 23:22:07)

Topic: Embedded gallery not loading correctly [SOLVED]

I have recently started trying Juicebox-lite, and am impressed with the ease of use. I do have a problem though once I embed the gallery on a website, in that it does not load correctly until I refresh the page. I have read that this appears to be a common glitch, and I have tried a few suggested solutions (alter Viewport code), but still cant get it to work. Do I need to edit css?  If so exactly what should I do? Excuse me - I am a newbie to all this.

Error appears to be the same in all browsers.
I have done a test site to show the problem (click on "Galeri")
Many thanks

(URL now removed, as problem solved)

Re: Embedded gallery not loading correctly [SOLVED]

It looks like you are embedding your gallery into a pop-up window but you are loading your gallery as soon as your web page loads (before the pop-up window exists).
At the time the gallery loads, the pop-up window has no dimensions and the gallery's own dimensions are defined as 100% x 100% (i.e. 100% of the gallery's parent container). Therefore, Juicebox cannot determine the actual dimensions for the gallery (100% of zero is zero).

You could either:
(1) Change the gallery's dimensions to absolute pixel values (both the widths and height) such as '600px' instead of '100%'.
... or:
(2) Put the gallery's embedding code in a Javascript function and run the function (to load the gallery) only after the pop-up window is ready. Try using the following embedding code.

<!--START JUICEBOX EMBED-->
<script src="jbcore/juicebox.js"></script>
<script>
    function loadGallery() {
        new juicebox({
            containerId: "juicebox-container",
            galleryWidth: "100%",
            galleryHeight: "100%",
            backgroundColor: "rgba(34,34,34,1)"
        });
    }
    $(document).ready(function() {
        $("a:contains('Galeri')").click(function() {
            window.setTimeout(function() {
                loadGallery()
            }, 500);
        });
    });
</script>
<div id="juicebox-container"></div>
<!--END JUICEBOX EMBED-->

The short delay (the window.setTimeout() of 500ms) may be required to allow the pop-up window time to generate before the gallery is loaded.

I hope this helps.

Re: Embedded gallery not loading correctly [SOLVED]

I guessed that was the problem, but couldnt work out how to sort it.

Your solution works fine!

Many thanks for sorting this Steven.

Re: Embedded gallery not loading correctly [SOLVED]

Your solution works fine!

That's great! Thank you for letting me know.

Many thanks for sorting this Steven.

You're welcome!