Topic: [SOLVED] Mutiple Galleries On One Page With Header

I'm new to coding so am struggling a bit to know what code needs to go where.

I have created 2 galleries and saved them in separate folders, where do I load the files in these directories to on my website?
What code do I have to put in my main website page to show the headers for the 2 galleries and then display the gallery on the same page when chosen?

I'm getting quite confused about what code needs to be in the website page header and body, and then what to do with the files (including html js and xml files for the two galleries).

Any help you can give would be greatly appreciated.
Thank you

Re: [SOLVED] Mutiple Galleries On One Page With Header

Take a look at the View Resizable Gallery with Top Menu Example in the Using a Resizable Gallery with a Header support section.
The sample has a header with links to two galleries. Each gallery is actually on a page of its own with the header duplicated in each page. You can view the source of the web pages in your browser and copy/modify the code as you like.

For a single page solution, try the following.
Create two galleries and name the gallery folders 'gallery1' and 'gallery2'.
Create a HTML file with the code below, put the file in the same directory as your two gallery folders and open it in a browser.

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <style type="text/css">
            html, body {
                height: 100%;
                overflow: hidden;
            }
            body {            
                margin: 0px;
            }
            #header {
                background-color: #222222;
                color: #666666;
                font-family: sans-serif;
                font-size: 20px;        
                height: 50px;
                padding-top: 10px;
                text-align: center;
                width: 100%;
            }
            #header a {
                color: #666666;
                text-decoration: none;
            }
            #wrap {
                width: 100%;
            }    
        </style>
        <script type="text/javascript" src="gallery1/jbcore/juicebox.js"></script>
        <script type="text/javascript">

            // Function to resize gallery
            function doLayout() {
                var windowHeight = window.innerHeight ? window.innerHeight : $(window).height();
                var headerHeight = $('#header').outerHeight();
                var galleryHeight = parseInt(windowHeight) - parseInt(headerHeight);
                $('#wrap').height(galleryHeight);
            }

            // Function to load selected gallery on demand using baseUrl
            function loadGallery(base) {
                new juicebox({
                    containerId: 'juicebox-container',
                    baseUrl: base
                });
            }

            // Run following code when page is initially loaded
            $(document).ready(function () {

                 // Run function to resize gallery
                doLayout();

                // Ensure function to resize gallery is run when browser window size changes
                $(window).bind('resize', doLayout);

                // Run function to load Gallery #1
                loadGallery('gallery1/');
            });
        </script>
        <title>Test</title>
    </head>
    <body>
        <div id="header">
            <a href="#" onclick="javascript: loadGallery('gallery1/'); return false;">Gallery 1</a>
            <span>&nbsp;</span>
            <a href="#" onclick="javascript: loadGallery('gallery2/'); return false;">Gallery 2</a>
        </div>
        <div id="wrap">
            <div id="juicebox-container"></div>
        </div>
    </body>
</html>

Re: [SOLVED] Mutiple Galleries On One Page With Header

Thanks so much, this worked a treat - I just need to sort out the spacing and colours now!

Re: [SOLVED] Mutiple Galleries On One Page With Header

First of all, try clearing your browser's cache to ensure that your browser is fetching and using the most recent gallery files from your web server. If this does not help, please post the URL to your 9th gallery and let me know what Gallery Title you see yourself and what Gallery Title you expect to see. Thank you.

Edit:
It looks like you have just deleted a couple of your posts.
Have you been able to solve your Gallery Title problem?

Re: [SOLVED] Mutiple Galleries On One Page With Header

Great program!  I've done the instructions above and so I've got a top menu. 

What code do I need for a side menu please?  And what do I delete in the example above and what do I put in please?

Many thanks

Re: [SOLVED] Mutiple Galleries On One Page With Header

What code do I need for a side menu please?

Take a look at the View Resizable Gallery with Side Menu Example in the Resizable Gallery support section.
Here is a similar all-in-one template to the one above to load multiple galleries from a side menu:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <style type="text/css">
            html, body {
                height: 100%;
                overflow: hidden;
            }
            body {
                margin: 0px;
                background-color: #222222;
            }
            #menu {
                background-color: #222222;
                color: #666666;
                font-family: sans-serif;
                font-size: 20px;
                float: left;
                text-align: center;
                padding-left: 15px;
                padding-top: 20px;
                height: 100%;
                width: 100px;
            }
            #menu a {
                color #666666;
                text-decoration: none;
            }
            #wrap {
                float: right;
                height: 100%;
            }
        </style>
        <script src="gallery1/jbcore/juicebox.js"></script>
        <script type="text/javascript">
            function doLayout() {
                var windowHeight = window.innerHeight ? window.innerHeight : $(window).height();
                var windowWidth = window.innerWidth ? window.innerWidth : $(window).width();
                var menuWidth = $('#menu').outerWidth();
                var galleryHeight = parseInt(windowHeight);
                var galleryWidth = parseInt(windowWidth) - parseInt(menuWidth);
                $('#wrap').height(galleryHeight);
                $('#wrap').width(galleryWidth);    
            }
            function loadGallery(base) {
                new juicebox({
                    containerId: 'juicebox-container',
                    baseUrl: base
                    });
            }
            $(document).ready(function () {
                doLayout();
                $(window).on('resize', doLayout);
                loadGallery('gallery1/');
            });
        </script>
        <title>Test</title>
    </head>
    <body>
        <div id="menu">
            <a href="#" onclick="javascript: loadGallery('gallery1/'); return false;">Gallery 1</a>
            <br />
            <a href="#" onclick="javascript: loadGallery('gallery2/'); return false;">Gallery 2</a>
        </div>
        <div id="wrap">
            <div id="juicebox-container"></div>
        </div>
    </body>
</html>

Re: [SOLVED] Mutiple Galleries On One Page With Header

Thanks Steven for your speedy reply.  I copied and pasted the side menu code over the top menu code to replace it.  I still have gallery1 and gallery2 folders unaltered.  But what I see in my browser (emptied cache and refreshed) is just the menu items and no images.

Also the menu is pushed hard up in the top left hand corner.  How can it be nudged over a little from the left please eg 15 pixels.  Also a bit of a gap from the top eg 20 pixels.

Many thanks

Ant

Re: [SOLVED] Mutiple Galleries On One Page With Header

But what I see in my browser (emptied cache and refreshed) is just the menu items and no images.

Sorry. There was a problem with the path to the 'juicebox.js' file in my code.
I have corrected it in my post above.

Also the menu is pushed hard up in the top left hand corner.

The template page above was built for functionality rather than style (to keep things as simple and clear as possible). You can tweak the layout yourself using CSS.

How can it be nudged over a little from the left please eg 15 pixels.  Also a bit of a gap from the top eg 20 pixels.

Add the following CSS to the <head> section of the page:

#menu {
    padding-left: 15px;
    padding-top: 20px;
}

(I have added this CSS padding to the template page above.)

Re: [SOLVED] Mutiple Galleries On One Page With Header

Many thanks Steven

10

Re: [SOLVED] Mutiple Galleries On One Page With Header

Hello

Following on from 2013-11-05 19:44:40 Multiple Galleries On One Page With Header (that's where the code comes from)

I'm trying to put together a resizable gallery such as in  http://www.juicebox.net/demos/support/r … index.html

I can do this, but instead of Gallery 1, Gallery 2 etc. I'd like something like Sue's garden,  Neil and Fiona's garden.  Is this allowed to have different names for the galleries? Is the apostrophe a problem? I've spent some time (understatement) trying to do the things that are described and not having much skill.

In the code below I've put in capitals some questions

<!DOCTYPE html>
<html lang="en">
  <head>
      <meta charset="utf-8" />
      <meta name="apple-mobile-web-app-capable" content="yes" />
      <style type="text/css">
          html, body {
              height: 100%;
              overflow: hidden;
          }
          body {
              margin: 0px;
              background-color: #222222;
          }
          #menu {
              background-color: #222222;
              color: #666666;
              font-family: sans-serif;
              font-size: 20px;
              float: left;
              text-align: center;
              padding-left: 15px;
              padding-top: 20px;
              height: 100%;
              width: 100px;
          }
          #menu a {
              color #666666;
              text-decoration: none;
          }
          #wrap {
              float: right;
              height: 100%;
          }
      </style>
      <script src="gallery1/jbcore/juicebox.js"></script>
      <script type="text/javascript">
          function doLayout() {
              var windowHeight = window.innerHeight ? window.innerHeight : $(window).height();
              var windowWidth = window.innerWidth ? window.innerWidth : $(window).width();
              var menuWidth = $('#menu').outerWidth();
              var galleryHeight = parseInt(windowHeight);
              var galleryWidth = parseInt(windowWidth) - parseInt(menuWidth);
              $('#wrap').height(galleryHeight);
              $('#wrap').width(galleryWidth);              }
          function loadGallery(base) {
              new juicebox({
                  containerId: 'juicebox-container',
                  baseUrl: base
                  });
          }
          $(document).ready(function () {
              doLayout();
              $(window).on('resize', doLayout);
              loadGallery('gallery1/');  REPLACE gallery1 with sue'sgarden (all lower case one word)
          });
      </script>
      <title>Test</title>
  </head>
  <body>
      <div id="menu">
          <a href="#" onclick="javascript: loadGallery('gallery1/'); return false;">Gallery 1</a>    REPLACE gallery1 with sue'sgarden (all lower case one word) and replace Gallery 1 with Sue's garden
          <br />
          <a href="#" onclick="javascript: loadGallery('gallery2/'); return false;">Gallery 2</a>   REPLACE gallery1 with neilandfiona'sgarden (all lower case one word) and replace Gallery 1 with Neil and Fiona's garden
      </div>
      <div id="wrap">
          <div id="juicebox-container"></div>
      </div>
  </body>
</html>

When I'm generating the galleries, I name a new folder Sue's garden which is in the same directory as the html page.  I also do another folder Neil and Fiona's garden, again in the same directory.   Is this correct please?

The html page is index by default.  Do I change this to the HTML page where the gallery sits eg juiceboxprac.html or keep it at index.html?

Many thanks

Re: [SOLVED] Mutiple Galleries On One Page With Header

Is this allowed to have different names for the galleries?

Yes.

Is the apostrophe a problem?

Yes - for two reasons:
(1) The gallery's folder name in the line loadGallery('gallery1/'); is enclosed within apostrophes itself and the apostrophe in your gallery's folder name will effectively close the opening apostrophe in the code. You could enclose the gallery name in double quotes instead loadGallery("gallery1/"); (or escape the apostrophe to &apos;) but there is another reason why you should not use apostophes in folder names...
(2) As the gallery folder name forms part of a URL when it is uploaded to a web server, it would be wise to stick to web-safe characters. Please see section 2.3 of this document for details.

Characters that are allowed in a URI but do not have a reserved purpose are called unreserved. These include uppercase and lowercase letters, decimal digits, hyphen, period, underscore, and tilde.

When I'm generating the galleries, I name a new folder Sue's garden which is in the same directory as the html page.  I also do another folder Neil and Fiona's garden, again in the same directory.   Is this correct please?

Yes. Keep all your galleries separate from each other in individual folders and put all the gallery folders in the same directory alongside the HTML page containing the code above.

The html page is index by default.  Do I change this to the HTML page where the gallery sits eg juiceboxprac.html or keep it at index.html?

As you are embedding your galleries using the baseUrl method, the 'index.html' files within each gallery folder are not actually being used at all. You can name them whatever you like (or even delete them after the galleries have been created).

12

Re: [SOLVED] Mutiple Galleries On One Page With Header

Thanks for your help- much appreciated. 

I'm just getting a menu up in my html page and no galleries.

I've generated galleries in Juicebox called North Perth garden, Rossmoyne garden, North Fremantle garden, Wembley Downs courtyard, East Fremantle courtyard and Willeton garden and all are situated in my website folder together with my juiceONE.html file.  The individual galleries are good in that I can view them when I select each individual folder's index.html.  However they aren't appearing in the juiceONE.html

The code for juiceONE.html is below:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <style type="text/css">
            html, body {
                height: 100%;
                overflow: hidden;
            }
            body {
    margin: 0px;
    background-color: #FFF;
            }
            #menu {
    background-color: #FFF;
    color: #C36;
    font-family: "Century Gothic", Helvetica, Arial;
    font-size:14px;
    line-height:20px;
    float: left;
    text-align: left;
    padding-left: 20px;
    padding-top: 25px;
    height: 100%;
    width: 250px;
            }
            #menu a {
    color: #666;
    text-decoration: none;
            }
            #wrap {
                float: right;
                height: 100%;
            }
        body,td,th {
    color: #666;
}
        </style>
<script src="northperthgarden/jbcore/juicebox.js"></script>
        <script type="text/javascript">
            function doLayout() {
                var windowHeight = window.innerHeight ? window.innerHeight : $(window).height();
                var windowWidth = window.innerWidth ? window.innerWidth : $(window).width();
                var menuWidth = $('#menu').outerWidth();
                var galleryHeight = parseInt(windowHeight);
                var galleryWidth = parseInt(windowWidth) - parseInt(menuWidth);
                $('#wrap').height(galleryHeight);
                $('#wrap').width(galleryWidth);   
            }
            function loadGallery(base) {
                new juicebox({
                    containerId: 'juicebox-container',
                    baseUrl: base
                    });
            }
            $(document).ready(function () {
                doLayout();
                $(window).on('resize', doLayout);
                loadGallery('northperthgarden/');
            });
        </script>
        <title>Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
<body>
        <div id="menu">
            <a href="#" onclick="javascript: loadGallery('northperthgarden/'); return false;">North Perth garden</a>
            <br />
            <a href="#" onclick="javascript: loadGallery('rossmoynegarden/'); return false;">Rossmoyne garden</a>
            <br />
            <a href="#" onclick="javascript: loadGallery('northfremantlegarden/'); return false;">North Fremantle garden</a>
            <br />
            <a href="#" onclick="javascript: loadGallery('wembleydownscourtyard/'); return false;">Wembley Downs courtyard</a>       
            <br />
            <a href="#" onclick="javascript: loadGallery('eastfremantlecourtyard/'); return false;">East Fremantle courtyard</a>
            <br />
            <a href="#" onclick="javascript: loadGallery('willetongarden/'); return false;">Willeton garden</a           
        ></div>
<div id="wrap">
            <div id="juicebox-container"></div>
        </div>
    </body>
</html>

Many thanks

Re: [SOLVED] Mutiple Galleries On One Page With Header

I see no problem with your code and it works in a test scenario I set up using gallery folders with the same names as yours.
Check that your baseUrl paths exactly match the names of your gallery folders, making sure that there are no uppercase characters in your folder names (as there are no uppercase characters in your baseUrl paths and web servers are usually case-sensitive).
If this does not help, please post the URL to your web page so that I can take a look and help further.

14

Re: [SOLVED] Mutiple Galleries On One Page With Header

I've changed the name of the folders all to lower case.  Resaved the galleries in Juice Box.  No skill or luck.  Loaded the galleries and juiceone.html (changed that to lowercase too).  It's all uploaded to akl.com.au

Thanks

15

Re: [SOLVED] Mutiple Galleries On One Page With Header

Hi Steven

www.akl.com.au/juiceone.html  Just the menus are appearing and no galleries.  If you could have a look please it is most appreciated.

Many thanks

Re: [SOLVED] Mutiple Galleries On One Page With Header

Your page at http://akl.com.au/juiceone.html contains the line:

<script src="northperthgarden/jbcore/juicebox.js"></script>

... but there is no 'juicebox.js' file in that location.
Check that this line of code points towards a 'juicebox.js' file on your web server.

17

Re: [SOLVED] Mutiple Galleries On One Page With Header

I don't understand.  When I check my server there is a 196 kb file juicebox.js file in north perth garden.

Re: [SOLVED] Mutiple Galleries On One Page With Header

According to your code, the file should be located here: http://akl.com.au/northperthgarden/jbcore/juicebox.js
However, if you go directly to that address in a browser and you will see an error 404 (file not found).

It looks like none of your gallery folders have been uploaded to the root directory of your web space (at least not with the folder names used in your 'juiceone.html' file).

Double-check the names and location of your gallery folders on your web server.

Edit:
I have just found the cause of your problem.
Your gallery folder names contain spaces but the references to them in your 'juiceone.html' file do not.
They must match. 'northperthgarden' is not the same as 'north perth garden'.

19

Re: [SOLVED] Mutiple Galleries On One Page With Header

Thanks Steven.  I had an eureka moment myself about 10 minutes after seeing your first reply.  Then dinner.   I changed the folders to no spaces and it works.  I'm certainly no expert at this- I bumble along.  It would be nice if you were able to generate some galleries  so that amateurs like myself could have a look and see, and then copy and modify.  I'm sure the experts have no problems.  Thanks again.

Re: [SOLVED] Mutiple Galleries On One Page With Header

It would be nice if you were able to generate some galleries  so that amateurs like myself could have a look and see, and then copy and modify.

There are online examples for Embedding Multiple Galleries here. You can view the source of the sample gallery web pages in your browser and copy or modify the code as required.

21

Re: [SOLVED] Mutiple Galleries On One Page With Header

Steven

The gallery works fine on my computer. But friends say they can't see my gallery, only the menus, on their ipads and iphones.  I've checked the mark up code http://validator.w3.org/ and the only error message I get is:

Line 43, Column 50: required attribute "type" not specified
<script src="northperthgarden/jbcore/juicebox.js"></script>

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.

The gallery is http://www.akl.com.au/gallery.html

Re: [SOLVED] Mutiple Galleries On One Page With Header

We recommend the use of the HTML 5 Doctype (please see here for details) for which the 'type' attribute is optional.
Please see this web page for details:

The type attribute gives the language of the script or format of the data. If the attribute is present, its value must be a valid MIME type. The charset parameter must not be specified. The default, which is used if the attribute is absent, is "text/javascript".

Your web page uses the XHTML 1.0 Doctype which is why the 'type' attribute is required for validation.
All 'index.html' pages generated by JuiceboxBuilder-Pro and Juicebox plugins use the HTML 5 Doctype.
Try validating a 'index.html' page generated by JuiceboxBuilder-Pro and you should see that it validates correctly without the <script> tag having a 'type' attribute.

However, this will not be the reason for your problem.
All modern browsers will be able to correctly process the contents of a <script> tag without it having a 'type' attribute.

It sounds like your friends with mobile devices may be using 3G connections rather than Wi-Fi to view your galleries.
If so, then please see this FAQ for details:
Why can't I view my gallery on a 3G mobile connection?

Create an .htaccess file containing the following code and upload it to your website's root directory. (Please note that this requires an Apache web server.)

<IfModule mod_headers.c>
Header set Cache-Control "no-transform"
</IfModule>

This should prevent content modification on your site when visitors view your galleries over a 3G connection.

23

Re: [SOLVED] Mutiple Galleries On One Page With Header

Thanks Steven

I already had a /.htaccess file so I placed the code there, as below:

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<IfModule mod_headers.c>
Header set Cache-Control "no-transform"
</IfModule>
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.akl.com.au
AuthUserFile /home/aklcom/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/aklcom/public_html/_vti_pvt/service.grp

Is this correct?  Please excuse my ignorance.  Thank you.

Re: [SOLVED] Mutiple Galleries On One Page With Header

Yes. That should be fine.

25

Re: [SOLVED] Mutiple Galleries On One Page With Header

Thanks Steven.  I've had two friends report back that the gallery is not showing, just the menus.  I'll get more feedback soon from others.  How does it look from your perspective? Thanks