Site URL: https://www.nanoesclab.com/publications
I have a markdown containing a large amount of items. They are categorised by year, which each collapsible item labelled as a year.
I have the following script in my page settings, which works fine.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('.markdown-block .sqs-block-content h2').css('cursor','pointer');
$(".markdown-block .sqs-block-content h2").nextUntil("h2").slideToggle();
$(".markdown-block .sqs-block-content h2").click(function() {$(this).nextUntil("h2").slideToggle();});
});
$(document).ready(function(){
$('.markdown-block .sqs-block-content h2').click(function()
{$(this).toggleClass('plus-minus');});
});
</script>
However, I'd like it to only have one year open at a time. So when a new year is clicked the previously open one will automatically close.
Any ideas??