From 2eab25e7c14588df5438fbaa4447d54c1a9c6b7e Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 8 Oct 2023 10:28:17 -0400 Subject: [PATCH 1/2] Add caption to described images without a preview --- view/templates/content/image/single.tpl | 7 ++++++- .../content/image/single_with_height_allocation.tpl | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/view/templates/content/image/single.tpl b/view/templates/content/image/single.tpl index b3dfb7413..ea19c48a5 100644 --- a/view/templates/content/image/single.tpl +++ b/view/templates/content/image/single.tpl @@ -1,5 +1,10 @@ {{if $image->preview}} {{$image->description}} {{else}} -{{$image->description}} +
+ {{$image->description}} + {{if $image->description}} +
{{$image->description}}
+ {{/if}} +
{{/if}} diff --git a/view/templates/content/image/single_with_height_allocation.tpl b/view/templates/content/image/single_with_height_allocation.tpl index 1d70194be..60b4669e3 100644 --- a/view/templates/content/image/single_with_height_allocation.tpl +++ b/view/templates/content/image/single_with_height_allocation.tpl @@ -12,6 +12,9 @@ {{else}} {{$image->description}} + {{if $image->description}} +
{{$image->description}}
+ {{/if}} {{/if}} From 36eced28b8761630826c2e5d2c167d50ab3305e5 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 8 Oct 2023 10:29:09 -0400 Subject: [PATCH 2/2] Add caption display for described images in Fancybox gallery --- view/js/fancybox/fancybox.config.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/view/js/fancybox/fancybox.config.js b/view/js/fancybox/fancybox.config.js index 233b423f9..94a67eb7f 100644 --- a/view/js/fancybox/fancybox.config.js +++ b/view/js/fancybox/fancybox.config.js @@ -1,13 +1,10 @@ $(document).ready(function() { $.fancybox.defaults.loop = "true"; - // this disables the colorbox hook found in frio/js/modal.js:34 - $("body").off("click", ".wall-item-body a img"); - - // Adds ALT/TITLE text to fancybox - $('a[data-fancybox').fancybox({ - afterLoad : function(instance, current) { - current.$image.attr('alt', current.opts.$orig.find('img').attr('alt') ); - current.$image.attr('title', current.opts.$orig.find('img').attr('title') ); - } - }); -}); \ No newline at end of file + $.fancybox.defaults.afterLoad = function(instance, current) { + current.$image.attr('alt', current.opts.$orig.find('img').attr('alt') ); + current.$image.attr('title', current.opts.$orig.find('img').attr('title') ); + }; + $.fancybox.defaults.caption = function (instance, slide, caption) { + return slide.$thumb.attr('alt'); + }; +});