Peter550 Posted May 19, 2021 Posted May 19, 2021 (edited) hi @tuanphan I want these markdowns to be accordion drop-downs in the additional information section. I have added the code into the code injection (see screenshot and below) following this guide - https://stnsvn.com/blog/how-to-add-an-accordion-to-squarespace and use markdowns for the sections. But its not working. I cant click on the + signs and they do not hide the text below. They are visible like in the screenshot all the time. Any idea how to resolve this? /*Accordion Page Settings*/ <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> Edited June 24, 2021 by Peter550 tracydickason 1
Agha_Waqas Posted May 19, 2021 Posted May 19, 2021 7 minutes ago, Peter550 said: Site URL: https://www.saccostyle.com/ hi @tuanphan I want these markdowns to be accordion drop-downs in the additional information section. I have added the code into the code injection (see screenshot and below) following this guide - https://stnsvn.com/blog/how-to-add-an-accordion-to-squarespace and use markdowns for the sections. But its not working. I cant click on the + signs and they do not hide the text below. They are visible like in the screenshot all the time. Any idea how to resolve this? /*Accordion Page Settings*/ <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> Hi, i review your website and it seems like you are using h3 for the accordion. simply replace the h2 to h3 into JavaScript code and it will works. tracydickason 1
Peter550 Posted May 19, 2021 Author Posted May 19, 2021 Legend! Thank you. Can you help spread out the accordions so they cover the full width of the line below? tracydickason 1
Agha_Waqas Posted May 19, 2021 Posted May 19, 2021 8 minutes ago, Peter550 said: Legend! Thank you. Can you help spread out the accordions so they cover the full width of the line below? I think you already fix it. now accordions show into 4 columns tracydickason 1
Peter550 Posted May 19, 2021 Author Posted May 19, 2021 Also, if I were to change the accordions to a paragraph font, what would I change the code to? tracydickason 1
Peter550 Posted May 19, 2021 Author Posted May 19, 2021 I would like them to reach the end of the line below - ie. They span the full width I imagine its something to do with padding that I can channge with custom CSS? @tuanphan tracydickason 1
Agha_Waqas Posted May 19, 2021 Posted May 19, 2021 13 minutes ago, Peter550 said: Also, if I were to change the accordions to a paragraph font, what would I change the code to? if you want to change the font size of the accordion heading. add below code .markdown-block h4 { font-size: calc(1 * 1rem) !important;} tracydickason 1
tracydickason Posted May 30, 2021 Posted May 30, 2021 (edited) On 5/20/2021 at 8:11 AM, Peter550 said: Legend! Thank you. Can you help spread out the accordions so they cover the full width of the line below? Hi @Peter550 Thanks for raising the questions, it has been very helpful reading your posts as I was following the same site for the accordion and having issues. I would also like to spread the accordions into columns, would you mind sharing the code you used to create the columns? Thanks Tracy Edited May 31, 2021 by tracydickason
tracydickason Posted May 31, 2021 Posted May 31, 2021 Hi @Agha_Waqas, I've followed your help that you have given Peter and I was wondering if you could give me a hand with the accordion code. The +- is not showing up for me for some reason. I would also like to be able to spread the questions over columns, would you be able to help me with this? I've added a screen shot of the code as well as the page as the resulting page. Thanks so much. Tracy
Agha_Waqas Posted May 31, 2021 Posted May 31, 2021 21 hours ago, tracydickason said: Hi @Agha_Waqas, I've followed your help that you have given Peter and I was wondering if you could give me a hand with the accordion code. The +- is not showing up for me for some reason. I would also like to be able to spread the questions over columns, would you be able to help me with this? I've added a screen shot of the code as well as the page as the resulting page. Thanks so much. Tracy Hi Tracy, Will you please share the website link? tracydickason 1
tracydickason Posted June 1, 2021 Posted June 1, 2021 Hi @Agha_Waqas It is still in it's early stages but the link is: https://oriole-sapphire-2pbm.squarespace.com/config/pages Thanks so much for having a look. Tracy
creedon Posted June 1, 2021 Posted June 1, 2021 @tracydickason Please post your site-wide password. We can then take a look at your issue. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.
Solution Amaya_SQSP Posted February 9, 2022 Solution Posted February 9, 2022 Hey all! It is now possible to add an accordion menu to your site without custom code using the accordion block! We have some information about the possibilities and customizations of the Accordion Block in our guide "Accordion blocks."
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment