我在全屏调整大小时遇到问题,在加载第二个库后会停止工作。它在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' );
});
您可以尝试在setOptions
:之后调用.rescale()
Galleria.get(0).setOptions( 'imageCrop', 'false' ).rescale();