From f8295635c1e158d380fda9d252c3d161c1382521 Mon Sep 17 00:00:00 2001 From: Grischa Brockhaus Date: Mon, 19 Dec 2022 00:52:31 +0100 Subject: [PATCH] Added ALT and TITLE of original IMG to fancybox popup. --- fancybox/CHANGELOG.md | 8 ++++++++ fancybox/asset/fancybox/fancybox.config.js | 8 ++++++++ fancybox/fancybox.php | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/fancybox/CHANGELOG.md b/fancybox/CHANGELOG.md index 3d676c0c..d597e0bf 100644 --- a/fancybox/CHANGELOG.md +++ b/fancybox/CHANGELOG.md @@ -1,3 +1,11 @@ +### Version 1.05 + +* Added ALT and TITLE of original IMG to fancybox popup. + +### Version 1.04 + +* Update supporting upcoming imnagegrid in posts + ### Version 1.03 * imgages in body-attach with title / alt attribute get them removed while adding fancy attributes diff --git a/fancybox/asset/fancybox/fancybox.config.js b/fancybox/asset/fancybox/fancybox.config.js index 2b9c4f41..233b423f 100644 --- a/fancybox/asset/fancybox/fancybox.config.js +++ b/fancybox/asset/fancybox/fancybox.config.js @@ -2,4 +2,12 @@ $(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 diff --git a/fancybox/fancybox.php b/fancybox/fancybox.php index 56503622..b96a90d3 100644 --- a/fancybox/fancybox.php +++ b/fancybox/fancybox.php @@ -2,7 +2,7 @@ /** * Name: Fancybox * Description: Open media attachments of posts into a fancybox overlay. - * Version: 1.04 + * Version: 1.05 * Author: Grischa Brockhaus */