调整窗口大小时,可以优雅地自动调整Galleria jQuery幻灯片的大小 [英] Elegantly auto-resize Galleria jQuery slideshow when window is resized
问题描述
我正在使用Galleria jQuery幻灯片插件.我可以通过用$(document).width()和$(document).height()指定宽度和高度来使幻灯片显示充满整个浏览器窗口,然后一切都会按需进行.下面的代码:
I am using the Galleria jQuery slideshow plugin. I can get the slideshow to fill the full browser window by specifying the width and height with $(document).width() and $(document).height() and everything works as desired. Code below:
Galleria.loadTheme('galleria/themes/classic/galleria.classic.min.js');
$("#gallery").galleria({
width: $(document).width(),
height: $(document).height()
});
我还输入了以下代码来调整窗口大小:
I also put in the following code to handle when the window is resized:
$(window).resize(function() {
location.reload();
});
可以,但是可以全屏刷新,不如Galleria的实现优雅, http://galleria.io/themes/fullscreen/.有没有一种方法可以调整幻灯片的大小而不必使用默认外观重新加载整个页面?
That works but it does a full screen refresh and isn't as elegant as Galleria's implementation, http://galleria.io/themes/fullscreen/. Is there a way to resize the slideshow without having to reload the entire page using the default skin?
推荐答案
如果使用扩展功能,可以将幻灯片设置为全屏显示,并且在调整窗口大小时会自动调整幻灯片大小,而无需重新加载整个页面.
Turns out if I use the extend functionality I can set the slideshow to be full screen and it will automatically resize when the window is resized without reloading the full page.
$("#gallery").galleria({
width: $(document).width(),
height: $(document).height(),
extend: function() {
this.enterFullscreen();
}
});
这篇关于调整窗口大小时,可以优雅地自动调整Galleria jQuery幻灯片的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!