Topic: Suggestion: Switching design by button and a widget for wordpress

Hi there,

I'd like to suggest two things:

What about a button two switches between two or more color schemes, so the visitor can decide the one he likes best?

For example the current version of my gallery is on #ffffff white background, but there are some nightshots which look better on  #000000.
Wouldn't it be great to have a button that switches between these backgrounds?

Just a suggestion of a guy who does not know anything about coding :-)


Another suggestion would be a widget for wordpress, displaying either the latest or a random image.

Again: Just a suggestion of a guy who does not know any little thing about coding :-)


Thanks for the great gallery and thanks for your quick responses to any question we are posting to this forum.

Re: Suggestion: Switching design by button and a widget for wordpress

Wouldn't it be great to have a button that switches between these backgrounds?

As you are probably aware, it is not possible to change a configuration option once a gallery has been loaded.
However, you could reload the Juicebox gallery on your page with different settings (using links and a JavaScript function).
Here is an example with buttons to change the gallery's background to either black or white. (It also remembers which image was currently being displayed when a background color change is initiated and displays this image when the gallery is reloaded.)
Create a sample gallery with JuiceboxBuilder-Pro and replace the gallery's 'index.html' page with the the following code:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <style type="text/css">
            body {
                margin: 0px;
            }
        </style>
        <script type="text/javascript" src="jbcore/juicebox.js"></script>
        <script type="text/javascript">
            var index = 1, jb;
            function loadGallery(bc, fii) {
                jb = new juicebox({
                    backgroundColor: bc,
                    containerId: 'juicebox-container',
                    firstImageIndex: fii,
                    galleryHeight: '400',
                    galleryWidth: '600'
                });
            }
            $(document).ready(function() {
                $('#black').click(function() {
                    loadGallery('#000000', jb.getImageIndex());
                });
                $('#white').click(function() {
                    index = jb.getImageIndex();
                    loadGallery('#ffffff', jb.getImageIndex());
                });
                loadGallery('#000000');
            });
        </script>
        <title>Test</title>
    </head>
    <body>
        <div id="links">
            <input type="button" id="black" value="Black Background Color">
            <span>&nbsp;</span>
            <input type="button" id="white" value="White Background Color">
        </div>
        <div id="juicebox-container"></div>
    </body>
</html>

Another suggestion would be a widget for wordpress, displaying either the latest or a random image.

I'm not exactly sure what you mean by this. Would you want the gallery to be displayed in the theme's header or a sidebar? Either way, to create a widget to do this would probably involve a lot of work. Also, are you suggesting that the gallery pulls in a random image from the Media Library? That in itself would not be too much of a problem (though knowledge of the WordPress API would be required).
There is already a Juicebox plugin for WordPress (WP-Juicebox) but this embeds a Juicebox gallery as the main feature in a page or post and you would need to specify the images that you would like to be displayed (although you could set randomizeImages="TRUE" in the Pro Options text area).

Re: Suggestion: Switching design by button and a widget for wordpress

Thanks for the reply.
I'll safe that to my memorie and will give it a try :-)

Looking at that wordpress widget ... back in the days when I used NextGenGallery, you could add a widget to your sidebar, displaying either the latest or a random thumbnail from your gallery (in our case, it should be the one juicebox uses), and a click on that thumbnail led you to that image in the gallery.

Re: Suggestion: Switching design by button and a widget for wordpress

It sounds like the widget might require a lot of work.
It is certainly food for thought but I think it is unlikely that such a widget will be crafted in the near future.

You could perhaps achieve the same effect as the widget would have by trying the following (but it would also require a lot of work if you wanted to do it for many galleries).
You can already link to a specific image in a gallery by setting enableDirectLinks="TRUE" in the gallery's Pro Options text area and using a link with a # such as http://www.example.com/wordpress/?p=123#12 (where #12 specifies the 12th image in the gallery).
You could then (using an existing widget that allows you to enter custom HTML code) create an image link using a URL such as the one above.

Re: Suggestion: Switching design by button and a widget for wordpress

Thanks again for the response.
So maybe all "we" need would be a link to a random image?

But I do not know anything about coding, and I guess it's anything but easy.

And it was just a suggestion for a nice little gimmick - no really important issue.

Thanks again for spending your time to answer.

Regards from Germany,

Marco