fancybox
fancybox copied to clipboard
Previous image caption not cleared if next image caption is empty
Describe the bug If some images in gallery don't have caption or have empty caption, caption text for these images not cleared when navigate by images infancybox.
Bug demo: https://jsfiddle.net/Lo2mxu36/1/
To Reproduce Steps to reproduce the behavior:
- Create fancybox galley with some images without caption.
- Click on image with caption to open fancybox.
- Click next/prev to go to image without caption.
- See that caption is not empty but have value from latest viewed image with caption.
Expected behavior Caption contains actual value for current image. If image doesn't have caption or have empty caption, caption block in fancybox should be also be empty.
Desktop (please complete the following information):
- OS: Widows 10
- Browser Chrome
- Version 3.5.7
Additional context Add any other context about the problem here.
Seems that problem is here https://github.com/fancyapps/fancybox/blob/master/src/js/core.js#L2955 in if-state.
$caption.children().eq(0).html(caption) - should be called even if caption is empty.
Hi,
Hmm, true. sorry about that. You could, of course, clear caption using callbacks, if needed, but that will be included in the next update.