I'm using photoswipe in slideshow only mode, the photos are loaded via ajax call. I wanted the caption permanently affixed to the bottom of the slideshow. This is what I've come up with. Pay attention to the last two lines:
instance.toolbar.showCaption();
instance.toggleToolbar = function() {};
This forces the caption to display and then overwrites the toggle function with nothing. I have had no errors with this solution.
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;
}