我使用photoswipe以幻灯片模式只,照片通过ajax调用加载。我希望标题永久贴在幻灯片的底部。这是我想出来的。注意最后两行:
instance.toolbar.showCaption();
instance.toggleToolbar = function() {};
这迫使标题来显示,然后覆盖一无所有切换功能。这个解决方案我没有错误。
loadSlideshow = function(items){
var options = {
captionAndToolbarOpacity: 0.9,
captionAndToolbarFlipPosition: true,
captionAndToolbarAutoHideDelay: 0,
captionAndToolbarShowEmptyCaptions: true,
preventHide: false,
enableKeyboard: false,
autoStartSlideshow: true,
target: $('#PhotoSwipeTarget'),
imageScaleMethod: 'fit',
preventHide: true,
margin: 0,
allowUserZoom: false,
backButtonHideEnabled: false,
//captionAndToolbarHide: true,
getImageSource: function(obj){
return obj.url;
},
getImageCaption: function(obj){
return obj.caption;
}
};
instance = window.Code.PhotoSwipe.attach(
items, options
);
instance.show(0);
instance.toolbar.showCaption();
instance.toggleToolbar = function() {};
return true;
}
您必须将不透明度设置为1!对工具栏和图像标题很重要。 – andi1984 2012-05-29 11:50:21