Topic: Resizing embedded gallery

I'm moving my gallery over from Flash running in an iFrame and would like to have similar resizing of an html embedded gallery where the stage is resized too.  Many years ago an excellent gent on the JAlbum forum helped me with the iFrame resizing code, but I have no idea how to adapt it for an embedded gallery.

Here is how my original Flash site works : http://www.grantsymon.com/e/ritz.html 

As you can see it works incredibly well.  Resizing is awesomely fast and also takes into account both landscape and portrait images, no matter which is active when resizing is performed.  This would appear to be a bug in Juicebox, because it doesn't work correctly.  You have to reload the page for the gallery to then fit correctly otherwise part of an image is cut off.

Here is the same gallery using Juicebox inside the iFrame.
http://www.qr-presse.eu/e/ritz-iframe.html
As you can see the Juicebox resizing doesn't work properly.

Here is the same gallery again, this time embedded in html as recommended by JuiceBox.
http://www.qr-presse.eu/e/ritz-html-embed.html
As you can see the gallery doesn't resize at all.


Here is the code that makes the iFrame resize.   Can it be adapted to work with an html embedded Juicebox gallery? :

# <script language="JavaScript" type="text/JavaScript">
# window.onload = frameLoad;
# window.onresize = frameResize;
#
# var albumPath = "http://www.grantsymon.com/JBx/Ritz/";
# var albumID = "JBox";
# var heightPadding = 110;
# var widthPadding = 200;
#
# function frameLoad(){
#   getSizes();
#   windowHeight = windowHeight-heightPadding;
#   windowWidth = windowWidth-widthPadding;
#   var albumFrame = document.getElementById(albumID);
#   albumFrame.height = windowHeight + "px";
#   albumFrame.width = windowWidth + "px";
#   albumFrame.src = albumPath;
# }
#
# function frameResize(){
#   getSizes();
#   windowHeight = windowHeight-heightPadding;
#   windowWidth = windowWidth-widthPadding;
#   var albumFrame = document.getElementById(albumID);
#   albumFrame.height = windowHeight + "px";
#   albumFrame.width = windowWidth + "px";
# }
#
# function getSizes(){
#   var totalHeight;
#   if (self.innerHeight)
#     windowHeight = self.innerHeight;
#   else if (document.documentElement && document.documentElement.clientHeight)
#     windowHeight = document.documentElement.clientHeight;
#   else if (document.body)
#     windowHeight = document.body.clientHeight;
#   var totalWidth;
#   if (self.innerWidth)
#     windowWidth = self.innerWidth;
#   else if (document.documentElement && document.documentElement.clientWidth)
#     windowWidth = document.documentElement.clientWidth;
#   else if (document.body)
#     windowWidth = document.body.clientWidth;
# }
# </script>

Re: Resizing embedded gallery

Here is the same gallery using Juicebox inside the iFrame.
http://www.qr-presse.eu/e/ritz-iframe.html
As you can see the Juicebox resizing doesn't work properly.

looks good to me.

Your current layout with the thumbs  on the side of the main image, requires a min width to show the main image and the thumbs at the same time, because the thumbs have a fixed size by design (which is good).

I asked for a feature almost a year ago that the thumbs move to bottom when there is not enough space.

Re: Resizing embedded gallery

If you resize the window with a vertical image active, then open a horizontal, the horizontal image is cut off the the right.

If OTOH you make the window small with a horizontal, then switch to a vertical it's ok.  Happens in Firefox and Safari.

Re: Resizing embedded gallery

If you resize the window with a vertical image active, then open a horizontal, the horizontal image is cut off

I do not see it in chrome.

Re: Resizing embedded gallery

If you resize the window with a vertical image active, then open a horizontal, the horizontal image is cut off the the right.

Happens in Firefox and Safari.

I do not see this in Firefox 19.0 or Safari 5.1.7 on my PC.
Try clearing your browser's cache to make sure that your browser is not hanging onto and using any older gallery files.

Re: Resizing embedded gallery

Cache is not the problem.  I can send a screen-movie if you want.  I'm on Mac.

Re: Resizing embedded gallery

Try validating your page with the W3C Markup Validation Service and fix the errors reported so that we can be sure that any HTML errors on your page are not contributing to your problem.

Here is the same gallery again, this time embedded in html as recommended by JuiceBox.
http://www.qr-presse.eu/e/ritz-html-embed.html
As you can see the gallery doesn't resize at all.

A Juicebox gallery will resize dynamically with the size of the user's browser window only if the dimensions of the gallery itself and those of all parent containers are expressed as percentages. If there is an absolute pixel value anywhere up the chain, the gallery's size will become fixed (e.g. 100% x 100% x 800px = 800px).
With this in mind, you could perhaps try using the baseUrl method of embedding (instead of an iframe) and use a layout which would allow this to happen.

Re: Resizing embedded gallery

The gallery ending "html-embed.html"  is using the baseUrl method.  This is exactly what I can't get to work.  The resizing works fine with my iFrame and the legacy javascript code I have from my previous Flash galleries.

The baseUrl gallery is resizing when the window is 'squished' width-ways, but it is not resizing when 'squished' vertically.  Nothing I try can get it to work correctly.

Re: Resizing embedded gallery

Your Juicebox-Pro gallery is inside your #pageDiv container which has been given a fixed height of 950px.
Your Juicebox gallery has a height of 100% (of its parent container) so 100% of 950px is 950px which results in your gallery having a fixed height of 950px (regardless of the height of the user's browser window).
Try changing the height of your #pageDiv container to a percentage (such as 100%) and your gallery should dynamically resize in both dimensions.

10

Re: Resizing embedded gallery

Thanks Steven.  I've been learning a lot about how to do this today.  Your pointer helps some more.

11 (edited by gfs 2013-02-26 12:53:21)

Re: Resizing embedded gallery

Steven, I'm still trying but going slightly crazy.  Can you shed any light on what is happening here?

In this test, the gallery resizes, but starts to cut into the image (right and bottom) when resized horizontally on a wide image.
http://www.qr-presse.eu/ritz-html-embed3.html

In this test, the gallery will not resize vertically inside the 'inline' container div.
http://www.qr-presse.eu/ritz-html-embed4.html

Re: Resizing embedded gallery

In this test, the gallery resizes, but starts to cut into the image (right and bottom) when resized horizontally on a wide image.
http://www.qr-presse.eu/ritz-html-embed3.html

This is because part of your gallery (to the right and bottom) spills over beyond the bounds of the browser window and is no longer visible.
Your gallery (and container div) both have a height of 100% so, under normal circumstances, the gallery should fill the height of the browser window. However, you have introduced margins which push the gallery down (truncating the gallery at the bottom).

In this test, the gallery will not resize vertically inside the 'inline' container div.
http://www.qr-presse.eu/ritz-html-embed4.html

Please see the note for Using Percentage Heights in the Embedding Guide.
In your test, the gallery takes up 70% of the browser window height (though this is not explicitly specified anywhere).
Change:

<DIV ID="item1">

... to:

<div id="item1" style="height: 70%;">

13

Re: Resizing embedded gallery

Thanks again Steven.  I'm using Freeway Pro for my sites, which makes this sort of intervention complex, but I shall endeavour to persevere.