我在全屏幕中调整大小时出现问题,在加载第二个图库后停止工作。它在load()调用之前完美地工作。我试图获得有关rescale()函数的更多信息,但还没有找到一种方法来使它工作。
// backstage
var firstGallery = [
{
image: "img/bg1.jpg"
},
{
image: "img/bg2.jpg"
},
{
image: "img/bg3.jpg"
}
];
// work commercial
var secondGallery = [
{
image: "img/commers1.jpg"
},
{
image: "img/commers2.jpg"
},
{
image: "img/commers3.jpg"
}
];
// Load fullscreen theme
Galleria.loadTheme('galleria/themes/fullscreen/galleria.fullscreen.min.js');
// Intialize Galleria
$('#gallery').galleria(
{
dataSource: firstGallery,
imageCrop: true,
autoplay: true,
transition: "slide",
thumbnails: false,
showInfo: true,
clicknext: true,
preload: 4,
swipe: true,
// maxScaleRatio: 1
}
);
$('#workEditorial').click(function() {
// byter ut bilderna i #gallery diven
Galleria.get(0).load(secondGallery);
Galleria.get(0).setOptions( 'imageCrop', 'false' );
});
$('#backstage').click(function() {
Galleria.get(0).load(firstGallery);
Galleria.get(0).setOptions( 'imageCrop', 'true' );
});
答案 0 :(得分:0)
您可以尝试在.rescale()
之后调用setOptions
:
Galleria.get(0).setOptions( 'imageCrop', 'false' ).rescale();