Topic: Juice box Chokes after more than three galleries on single page.

To recreate go to
http://libertycasket.qa.selectionroom.com/Mobile/Hamel/

Select ANY three galleries. Four will not show. HTML and Javascript for the page is below.

To test again Clear cache restart browser and select any other three galleries Four will not show.

Would debugging my self but by simply taking your script out of eval and turning it into a string var and the logging it to the console to get the source to then debug but, that's more time then I want to (or should have to) spend fixing this.

<!DOCTYPE html>
<html lang="en">
<!-- manifest="cache.manifest"> -->
<head>
    <title>Fabric Gallery</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta http-equiv="content-language" content="en" />
    <link rel="apple-touch-icon" href="favicon.png" />
    <link rel="apple-touch-icon-precomposed" href="favicon.png" />
    <!--prevents rendering-->
    <meta name="viewport" content="width = device-width, initial-scale = 1.0, user-scalable = no" />
    <!--width is pixels, range 200 to 10000-->
    <meta name="format-detection" content="telephone=no" />
    <!--disables automatic detection of possible phone numbers-->
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <!--specifies full-screen mode-->
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <!--specify full-screen mode first-->
    <script type="text/javascript">
        var debug = false;

        if (debug) {
            var cacheStatusValues = [];
            cacheStatusValues[0] = 'uncached';
            cacheStatusValues[1] = 'idle';
            cacheStatusValues[2] = 'checking';
            cacheStatusValues[3] = 'downloading';
            cacheStatusValues[4] = 'updateready';
            cacheStatusValues[5] = 'obsolete';

            var cache = window.applicationCache;
            cache.addEventListener('cached', logEvent, false);
            cache.addEventListener('checking', logEvent, false);
            cache.addEventListener('downloading', logEvent, false);
            cache.addEventListener('error', logEvent, false);
            cache.addEventListener('noupdate', logEvent, false);
            cache.addEventListener('obsolete', logEvent, false);
            cache.addEventListener('progress', logEvent, false);
            cache.addEventListener('updateready', logEvent, false);

            function logEvent(e) {
                var online, status, type, message;
                online = (navigator.onLine) ? 'yes' : 'no';
                status = cacheStatusValues[cache.status];
                type = e.type;
                message = 'online: ' + online;
                message += ', event: ' + type;
                message += ', status: ' + status;
                if (type == 'error' && navigator.onLine) {
                    message += ' (prolly a syntax error in manifest)';
                }
                console.log(message);
            }

            window.applicationCache.addEventListener(
                'updateready',
                function () {
                    window.applicationCache.swapCache();
                    console.log('swap cache has been called');
                },
                false
            );

            setInterval(function () { cache.update() }, 10000);
        }
    </script>
    <script type="text/javascript" src="jbcore/juicebox.js"></script>
    <style type="text/css">
        html, body
        {
            height: 100%;
            overflow: hidden;
        }
        body
        {
            margin: 0;
            padding: 0;
            background-color: #222;
            color: #666;
            font-family: sans-serif;
            font-size: 20px;
        }
       
        a
        {
            color: #ccc;
        }
       
        #header
        {
            text-align: center;
            background-color: #333;
            width: 100%;
            height: 5%;
            padding: 10px 0;
        }
       
        #footer
        {
            text-align: center;
            background-color: #333;
            color: #fff;
            width: 100%;
            height: 20px;
            padding: 10px 0;
            position: relative;
            bottom: 0;
            left: 0;
        }
       
        .juicebox-content
        {
            width: 100%;
            height: 95%;
        }
       
    </style>
    <script type="text/javascript">
        function showDiv(show) {
            var s = document.getElementById(show);
            if (!s) {
                return true;
            }
            s.style.display = "block";
            return true;
        }

        function hideDiv(hide) {
            var h = document.getElementById(hide);
            if (!h) {
                return true;
            }
            h.style.display = "none";
            return true;
        }
       
        var metals = new juicebox({
            containerId: 'juicebox-ngs',
            baseUrl: 'ngs/',
            showOpenButton: false
        });
        var _20ga = new juicebox({
            containerId: 'juicebox-20ga',
            baseUrl: '20ga/',
            showOpenButton: false
        });
        var _18ga = new juicebox({
            containerId: 'juicebox-18ga',
            baseUrl: '18ga/',
            showOpenButton: false
        });
        var woods = new juicebox({
            containerId: 'juicebox-woods',
            baseUrl: 'woods/',
            showOpenButton: false
        });

        function ShowNGS() {
            hideDiv('woods');
            hideDiv('18ga');
            hideDiv('20ga');
            showDiv('ngs');
        }

        function Show20GA() {
            hideDiv('woods');
            hideDiv('18ga');
            showDiv('20ga');
            hideDiv('ngs');
        }
        function Show18GA() {
            hideDiv('woods');
            showDiv('18ga');
            hideDiv('20ga');
            hideDiv('ngs');
        }

        function ShowWoods() {
            showDiv('woods');
            hideDiv('18ga');
            hideDiv('20ga');
            hideDiv('ngs');
        }

        ShowNGS();

           
    </script>
</head>
<body>
    <div id="header" style="height: 20px; background-color: #666666;">
        <a href="javascript: ShowNGS();">20 Ga NGS</a> | <a href="javascript: Show20GA();">20 Ga</a>
        <a href="javascript: Show18GA();">18 Ga</a> | <a href="javascript: ShowWoods();">Hardwoods</a>
    </div>
    <!--START JUICEBOX EMBED-->
    <div class="juicebox-content" id="ngs">
        <div id="juicebox-ngs">
        </div>
    </div>
    <!--END JUICEBOX EMBED-->
    <!--START JUICEBOX EMBED-->
    <div class="juicebox-content" id="20ga">
        <div id="juicebox-20ga">
        </div>
    </div>
    <!--END JUICEBOX EMBED-->
     <!--START JUICEBOX EMBED-->
    <div class="juicebox-content" id="18ga">
        <div id="juicebox-18ga">
        </div>
    </div>
    <!--END JUICEBOX EMBED-->
    <!--START JUICEBOX EMBED-->
    <div class="juicebox-content" id="woods">
        <div id="juicebox-woods">
        </div>
    </div>
    <!--END JUICEBOX EMBED-->
</body>
</html>

Re: Juice box Chokes after more than three galleries on single page.

I have viewed your web page in several browsers (IE10, Firefox 20.0, Chrome 26 and Safari 5.1.7) on my PC and do not see any galleries at all (due to your modification of the 'juicebox.js' file).

There is no reason why you should not be able to display 4 Juicebox galleries on the same page.
I regularly use jAlbum and the Juicebox Skin to create multiple-gallery albums (with a JavaScript tree menu which switches out many more than 4 galleries on the same page).

I have tried using the JavaScript you posted with 4 of my own test galleries and all worked fine. I can continually switch between all 4 galleries and have not yet been able to replicate the problem you describe. The only problem I encountered was when resizing the browser window and not refreshing the page (where the layout is incorrect) but this can be solved by setting the dimensions of your 'juicebox-content' divs using inline CSS (as documented in the 'Using Percentage Heights' section here).

Although my testing shows that your code seems to work OK, you might like to try using the Juicebox-Pro API's showGallery() method to show/hide your galleries.
Alternatively, you might like to try loading each gallery as it is selected (as the Juicebox Skin for jAlbum does) rather than load all your galleries at once and then hide/show them selectively.

Once you get your web page back up and running (by reinstating the 'juicebox.js' file to the stock version from Juicebox-Pro v1.2.0), please post back so that I can take a look at your web page for myself and please let me know what browser(s) you see this problem in.

Re: Juice box Chokes after more than three galleries on single page.

Thank you so very much for your suggestions. Here is what solved it. Not sure as to the initial cause but, I will investigate that when I have time.

Tried: showGallery() instead of my custom show/Hide methods. (still encountered the issue)

So i stripped all of the javascript I had wrote and cut back to only one html element and a single gallery variable.

I now instantiate a new gallery in the same div using that single variable each time I wish to show a gallery. Works perfect.