fixed window-size in prettyphoto

China☆狼群 提交于 2019-12-24 00:57:38

问题


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.

Thanks in advance Jacques


回答1:


There may not be any way to do what you want without modifying the prettyPhoto.js script.

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.



来源:https://stackoverflow.com/questions/6469214/fixed-window-size-in-prettyphoto

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!