From a94cdad245037590a725694c75150ff8b9c06d73 Mon Sep 17 00:00:00 2001 From: Kevin Simper Date: Fri, 15 Jun 2018 00:39:15 +0200 Subject: [PATCH] Fold out search result when direct linked --- templates/footer.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/templates/footer.html b/templates/footer.html index dc372d87..9ef36b15 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -61,5 +61,17 @@ }); $('.show').collapse(); + + // Coming from search result page click + if(window.location.hash !== "") { + // Somehow collapse is not working sync and calling show directly after + // yields no effect and there is no callback when it is ready + setTimeout(() => { + // Folds out the answer manually + $(window.location.hash).collapse('show') + // Avoids the answer being hidden by the floating header + window.scrollTo(0, $(window.location.hash).position().top) + }, 500) + }