I'm wanting to resize the entire galleria div and resize all the images dynamically generated using the galleria script.
so far I have
$(window).resize(function() {
var h = $(window).height();
var galleriaHeight = h-54;
var w = $(".content").width();
var galleriaWidth = w-18;
$("#galleria").height(galleriaHeight);
$("#galleria").width(w);
$(".galleria-stage").height(galleriaHeight);
$(".galleria-stage").width(galleriaWidth);
$(".galleria-images .galleria-image img").css({"max-height":"auto"});
$(".galleria-images .galleria-image img").css({"max-width":galleriaWidth-36});
$(".galleria-stage").height(galleriaHeight);
$(".galleria-stage").width(galleriaWidth);
$(".galleria-container").width(w);
$(".galleria-container").height(galleriaHeight);
$(".caption").width(w);
$(".counter-nav").width(w);
var sidebarHeight =h-54;
var contentHeight =h-36;
$(".sidebar1").height(sidebarHeight);
$(".content").height(contentHeight);
});
But everything is scaling unevenly and very messed up. Having looked at the fullscreen code, I have also added
this.bind(Galleria.RESCALE, function() {
POS = this.getStageHeight() - tab.height() - 2;
thumbs.css('top', OPEN ? POS - list.outerHeight() + 2 : POS);
var img = this.getActiveImage();
if (img)
{
fixCaption(img);
}
});
but that's not working either...
I suppose I want to reload the page after i resize but on the fly... or resize all elements relative to each other, or use the Galleria resize script ...
Any ideas?
I know this is old, but I don't see an answer anywhere. Hopefully it can help the next guy.
This will dynamically resize Galleria when the browser window is resized.
I ran into similar issues. I ended up binding the following function to the window resize event. I used the logic for the resize event from this post
First, set up the resize function:
Then bind it to the window resize event:
This will essentially re-initialize by reloading the default theme. In this example, I am using the second parameter to specify which image to show- otherwise it will display the first image. Be aware that this may cause another instance of Galleria. I believe this to be a bug, and posted on their forums. You can remove the older instances as follows:
Run it after the loadTheme method. Use settimeout to delay it, because loadTheme takes some time to complete. I use 200ms. Ugly, but I need some of the features in Galleria. Hope this helps.