pickupgoliath Posted December 22, 2021 Share Posted December 22, 2021 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?? Link to comment
SquareRefresh Posted December 22, 2021 Share Posted December 22, 2021 Hey @pickupgoliath try to use sqsp accordion block https://support.squarespace.com/hc/en-us/articles/4411581892749 SquareRefresh, premium plugins & templates that have an elevated feel. Plugins: Have your site stand out. Templates: Our templates are designed with versatility in mind.Get Freebies: Sometimes things in life are free. Browser our hand selected free plugins. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment