javascript 在漂亮照片中固定窗口大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6469214/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
fixed window-size in prettyphoto
提问by JacquesKnie
I'm using prettyphoto for a photo gallery in a django-app. My Images have a maximum height/width (with sorl-thumbnail), but the apect-ratios are different. Because of that, the window of prettyphoto also changes it's apect-ratio and the go-forward/go-back Buttons change positions (they move) everytime it loads the next/previous image. Is there a way to make prettyphoto have a fixed window size? Or add borders to the images so that their format is, for example, square. But I don't want to crop the image.
我在 django 应用程序中使用漂亮照片作为照片库。我的图像具有最大高度/宽度(带有 sorl-thumbnail),但纵横比不同。因此,prettyphoto 的窗口也会改变它的纵横比,并且每次加载下一个/上一个图像时前进/后退按钮都会改变位置(它们移动)。有没有办法让漂亮照片具有固定的窗口大小?或者为图像添加边框,使其格式为,例如,方形。但我不想裁剪图像。
Thanks in advance Jacques
提前致谢 雅克
回答by ipd
There may not be any way to do what you want without modifying the prettyPhoto.js script.
如果不修改prettyPhoto.js 脚本,可能没有任何方法可以做您想做的事情。
There are some options to prettyPhoto you could play with, to see if you can get the desired effect:
您可以使用漂亮照片的一些选项,看看是否可以获得所需的效果:
$(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto({
allow_resize: true, /* Resize the photos bigger than viewport. true/false */
default_width: 500,
default_height: 344,
horizontal_padding: 20
});
});
Good luck!
祝你好运!
ian.
伊恩。