From 34cad980d0ca5dc4fc9e938feffac84491f52b87 Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Thu, 28 Jan 2021 00:11:06 +0100 Subject: [PATCH] reintroduce lightbox, now with iFixIt steps Signed-off-by: Michel-FK --- docs/assets/js/custom.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/assets/js/custom.js b/docs/assets/js/custom.js index fdce47d..7204209 100644 --- a/docs/assets/js/custom.js +++ b/docs/assets/js/custom.js @@ -95,11 +95,34 @@ $(document).ready(function () { .clone() .removeClass("step-thumb") .addClass("step-picture") + .addClass("lightbox") .insertBefore($(this).parent()); /* Make the first thumbnail active by default */ $(this).addClass("active"); }) + + let imageGroups = [] + $(".lightbox").each(function () { + let imageSource = $(this).attr('src') + let imageAlt = $(this).attr('alt').replace(/ /g,"") + let imageTitle = $(this).attr('alt') + if (imageTitle) { + imageTitle = 'title="' + imageTitle + '" ' + } else { + imageTitle = '' + } + $(this). + wrap('') + imageGroups.push('.' + imageAlt) + }) + jQuery.unique(imageGroups) + imageGroups.forEach(imageGroupsSet) + + function imageGroupsSet (value) { + $(value).simpleLightbox() + } }) /* Attach a delegate function on mouse over thumbnail to change the