From 07ff53d7069f8b9ee88396288f3742aed9c789a2 Mon Sep 17 00:00:00 2001 From: Andreas Blaesius Date: Sat, 5 Sep 2020 10:52:40 +0200 Subject: [PATCH] Fix me... --- index.html | 3 +-- src/js/gestures.js | 1 + src/js/ui/photoswipe-ui-default.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 95c68bfcf..ebf7c5cd0 100644 --- a/index.html +++ b/index.html @@ -107,8 +107,7 @@ // Auto sized images { src: 'https://farm4.staticflickr.com/3920/15008465772_d50c8f0531_h.jpg', - autoSize: true, - title: 'Example caption. Image height and width defined via "autoSize: true"' + autoSize: true }, { src: 'https://farm6.staticflickr.com/5591/15008867125_b61960af01_h.jpg', diff --git a/src/js/gestures.js b/src/js/gestures.js index af549bbdc..8b17e1bce 100644 --- a/src/js/gestures.js +++ b/src/js/gestures.js @@ -984,6 +984,7 @@ var _gestureStartTime, ); if (itemChanged) { + self.ui.resetCaption(); self.updateCurrItem(true); } diff --git a/src/js/ui/photoswipe-ui-default.js b/src/js/ui/photoswipe-ui-default.js index c15421ae5..503943cbb 100644 --- a/src/js/ui/photoswipe-ui-default.js +++ b/src/js/ui/photoswipe-ui-default.js @@ -59,14 +59,14 @@ // If allowLongCaptions is true, position caption just under picture and show "Expand" button if necessary if (_options.allowLongCaptions) { - var imagePositionTop = item.initialPosition.y; - var apparentImageHeight = Math.round(item.h * item.initialZoomLevel); + var imagePositionTop = 0; + var apparentImageHeight = 1024; var gapTop = item.vGap.top; ui.resetCaption(); var naturalCaptionHeight = innerCaptionElement.clientHeight; - var captionCtrl = captionElement.querySelector('.pswp__button--caption--ctrl'); + var captionCtrl = document.querySelector('.pswp__button--caption--ctrl'); _setLayoutData(captionElement, imagePositionTop, apparentImageHeight, gapTop, naturalCaptionHeight); var layoutData = _getLayoutData(captionElement);