I am trying to use the jquery GalleryView slider plugin (http://spaceforaname.com/galleryview/) on a page with a responsive width - so when the window is resized the column containing the slider changes too.
I need to resize the slider when the window is resized.
You can see the page at http://www.folknfuture.com/product.php?id_product=1
So far I have done this...
Inside the plugin I put this (at about line 220) to make the slider fit to its containing div:
var parentW = $('#pb-right-column').width();
// panels
dom.gv_panel.css({
width: parentW,//this.opts.panel_width,
height: this.opts.panel_height
});
dom.gv_panelWrap.css({
width: gv.outerWidth(dom.gv_panel),
height: gv.outerHeight(dom.gv_panel)
});
dom.gv_overlay.css({
width: parentW//this.opts.panel_width
});
And then I create the gallery which works fine - but I have no clue how to make it change width when the window width changes. I tried setting 'gal' to null and then making a new gallery - but it doesnt work because the images have been removed from their initial containing div.
var gal;
$(document).ready(function(){
gal = $("#images").galleryView();
});
$(window).resize(function() {
//gal.init();
});
Do I need to init the gallery again? I cant even find any gallery objects when I inspect the scripts in my browser. Help would be much appreciated. Thanks in advance..
Nope that doesnt work because the #images div has disappeared when the gallery is created. So I tried the following:
var gal;
$(document).ready(function(){
gal = $("#images").galleryView();
});
function setGallery(width) {
gal.opts.panel_width = width; // panel_height:height
}
$(window).resize(function () {
//calculate relative height and width
var parentW = $('#pb-right-column').width();
setGallery(parentW);
});
But this doesnt work either because it says the gal object is undefined. Any other ideas?