Topic: Naming

Is there any reason that when embedding juicebox in an html page and naming the juicebox object other than "juicebox", it doesn't show on the page...? I cant even use the API methods... showGallery() or showImage() does nothing.

Thanks

Re: Naming

You can name the Juicebox object anything you like.
Here is an example page using the Juicebox API (with the Juicebox object named 'abc') which contains links to show and hide the gallery using the API method showGallery().

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Juicebox-Pro Gallery</title>
        <meta charset="utf-8" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="description" content="This is a Juicebox-Pro Gallery. Get yours at www.juicebox.net" />
        <style type="text/css">
            body {
                margin: 0px;
            }
        </style>
        <script src="jbcore/juicebox.js"></script>
        <script src="jquery-1.8.2.min.js"></script>
        <script type="text/javascript">
            var abc;
            $(document).ready(function () {
                abc = new juicebox({
                    containerId : 'juicebox-container',
                    galleryWidth: '400',
                    galleryHeight: '400'
                });
            });
            function show() {
                abc.showGallery(true);
            }
            function hide() {
                abc.showGallery(false);
            }
        </script>
    </head>
    <body>
        <div id="click">
            <a href="#" onclick="javascript: show();">Click here to show gallery.</a>
            <a href="#" onclick="javascript: hide();">Click here to hide gallery.</a>
        </div>
        <div id="juicebox-container"></div>
    </body>
</html>

Re: Naming

Ok then the problem may come from the fact that I'm using other jQuery apps in the same page (ex.: FlowSlider).
Does Juicebox requiere the jquery-1.8.2.min.js or any jquery.js would be ok?

Also when using alert(juicebox) on a link to test it, it outputs the whole juicebox "config message". I was expecting to get any object type or at least "undefined"...

Any idea?

Re: Naming

Juicebox is compatible with any version of jQuery.

Re: Naming

I'm so sorry! My problem was so simple that I can't even find it!
I forgot to set the "var x" to "new juicebox()".

It was :
var x;
new juicebox()...

Now working:
var x;
x = new juicebox()...
Then I can use x.showGallery(true); or anything else.

Oups.
Thanks a lot for your help!