Fold out search result when direct linked

This commit is contained in:
Kevin Simper 2018-06-15 00:39:15 +02:00
parent 5b9d615784
commit a94cdad245

View File

@ -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)
}
</script>
</div>