wklz Posted March 11, 2015 Share Posted March 11, 2015 (edited) FAQs with code Edited August 29, 2016 by Testing2134 retag logaritym, drawingwithindesign, bgrig and 1 other 4 Sell crazy some place else, we are all stocked up here Link to comment
Solution wklz Posted March 11, 2015 Author Solution Share Posted March 11, 2015 (edited) In order to achieve Show/Hide FAQs you can use the Markdown Block and a jQuery script, as shown in this tutorial on this site (here) First, you need to inject this code call below, in the site-wide Code Injection (Settings > Advanced > Code Injection Header): Code call: <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> Then, you need to add this jQuery script below in the page specific Code Injection: <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();}); }); </script> Then you will need to add a Markdown Block on the page with the following structure: ## **+ QUESTION 1** REPLY 1 ## **+ QUESTION 2** REPLY 2 ## **+ QUESTION 3** REPLY 3 In this video below, I have guided you through the whole process: SOURCE FOR THE CODE: Silva Bokis Edited March 11, 2015 by wklz Sell crazy some place else, we are all stocked up here Link to comment
Megalomaniac Posted August 31, 2015 Share Posted August 31, 2015 New Member here... This was very helpful for me learning how to do this for text, tested it and worked great. I just posted a similar question, one that poses the question how you would do this to text, galleries and images on a page. I have no idea and would like to see if someone could tackle this? https://answers.squarespace.com/questions/97633/how-do-i-create-hideshow-section-of-an-entire-page-of-text-images-and-or-galleries-in-squarespace-spoiler-functionaccordiancollapse Dedicated professional with 18 years of experience in Architectural + Interior Design and Urban Planning and with four years as an adjunct professor of Interior Design at Ringling College of Art + Design. Specializes in hospitality, entertainment, multi-family and mixed use architecture, interior design + planning. Expertise in programmatic design, conceptual design, design development, problem solving complex design scenarios, space + facility planning and urban and site development. Technical expert in BIM production, education + management, improving upon team workflow, efficiency, consistency, quality and confidence. Parametric modeling, 3D model coordination, 3D rendering and avid student of computational modeling. New to web development! Link to comment
Guest Posted March 4, 2016 Share Posted March 4, 2016 @wklz Thank you for your help. I tried this out but the javascript doesn't seem to be working in mine. I'm on the Mercer template. What do you think might be the issue? My site is: http://hexagongallery.com (WIP password: boardsofcanada). Thank you,A Link to comment
Guest Posted March 4, 2016 Share Posted March 4, 2016 @wklz Thank you for your help. I tried this out but the javascript doesn't seem to be working in mine. I'm on the Mercer template. What do you think might be the issue? My site is: http://hexagongallery.com (WIP password: boardsofcanada). Thank you,A Link to comment
Guest Posted August 9, 2016 Share Posted August 9, 2016 Hey @wklz, is it possible to change the font size of the subject line that drops down? (Question 1?) I can't figure it out. Have tried to change 'h2' to 'h3' and it just breaks the code. Link to comment
Guest Posted August 9, 2016 Share Posted August 9, 2016 Hey @wklz, is it possible to change the font size of the subject line that drops down? (Question 1?) I can't figure it out. Have tried to change 'h2' to 'h3' and it just breaks the code. Link to comment
Cthanatos Posted August 31, 2016 Share Posted August 31, 2016 This is Great! Thanks! I just had a question, how do I go about changing the Text properties on this page? Will I have to use CSS or is there an easier way? I noticed that the video example had the text specialized with colors and fonts and such. Thanks! Link to comment
karenh Posted October 4, 2016 Share Posted October 4, 2016 Hi this also isn't working for me. Is there an update? Link to comment
devonstank Posted December 11, 2016 Share Posted December 11, 2016 (edited) There are many solutions out there (some good and some bad), but you'll need to do some Googling to find them. Basically, you'll need to Have some JavaScript run under the code injection section to manipulate some HTML within a code block. This feature is typically called a drop-down accordion. Devon Stank @ Devonstank.com (Squarespace Tips & Tricks) Edited December 11, 2016 by Vexsoft Initial Revision Link to comment
PDubATL Posted January 28, 2017 Share Posted January 28, 2017 This did not work for my site: ATLSoundStudio.comMaybe it's because I have soundcloud code blocks embed for audio playbackBummer Link to comment
logaritym Posted May 1, 2017 Share Posted May 1, 2017 I found a solution which looks like this one, but has more customization options, and also can hide images. I have added the code here - > https://answers.squarespace.com/questions/176218/spoiler-button-hidereveal.html#answer-176381 Link to comment
Just_Sy Posted July 16, 2017 Share Posted July 16, 2017 Does this work if I'm working on an index? Would I have to inject the code on all pages of the index? Hope to hear from you soon! @wklz Link to comment
lulu.lindberg Posted June 1, 2018 Share Posted June 1, 2018 @wklz this solution was working on my site: https://www.ashbylake.net/about/until I added the links that say "Read the full Terms of Reference for the ... " I didn't change anything else... do you know what might be the fix? Thank you in advance! Link to comment
mrooks98102 Posted December 28, 2018 Share Posted December 28, 2018 Hi - I used these codes and worked out great. Just one little issue. When you go to the page, all of the content is expanded and the only way to get it to collapse is to refresh the page. Then it expands/collapses perfectly. How do I get the content to collapse from the onset of navigation? Here's my page for reference https://www.roosthomewatch.com/faq/ . Link to comment
mychentt Posted March 21, 2019 Share Posted March 21, 2019 Can anyone please please explain the function of each line of the code? I am trying to customize it a bit so that we don't have to call the show/hide function by "h2" -- the goal is to adjust the spacing before and after as well as the font type/size/color of the expanded item (i.e. the "question" in this case). It will be really helpful! Thank you in advance. Link to comment
schuler_jasmin Posted April 6, 2019 Share Posted April 6, 2019 @mrooks98102 I have the same issue! Did you find a solution for it?Thanks Jasmine Link to comment
mrooks98102 Posted April 6, 2019 Share Posted April 6, 2019 Hi - no, I haven't. Do you have one by chance? Link to comment
schuler_jasmin Posted April 7, 2019 Share Posted April 7, 2019 unfortunately, I don't :( Link to comment
mrooks98102 Posted April 8, 2019 Share Posted April 8, 2019 @wklz - Hi - I used these codes and worked out great. Just one little issue. When you go to the page, all of the content is expanded and the only way to get it to collapse is to refresh the page. Then it expands/collapses perfectly. How do I get the content to collapse from the onset of navigation? Here's my page for reference https://www.roosthomewatch.com/faq/ . Link to comment
Guest padma Posted July 19, 2019 Share Posted July 19, 2019 (edited) try this (three hashes (###) instead of two.) Edited July 19, 2019 by padma Initial Revision Link to comment
mrooks98102 Posted July 22, 2019 Share Posted July 22, 2019 Thanks for the suggestion but that didn't affect the accordion - it only changed the font size. I think the problem lies within the injection code of the page header, but I can't figure it out. Link to comment
artpimpress Posted September 9, 2021 Share Posted September 9, 2021 Thank you for the solution to add css to create the accordion affect. We would like to have the first "tab" open. Any adjustment advice on this? https://prism-bluebird-55bf.squarespace.com/speaking password: bair Link to comment
tuanphan Posted September 12, 2021 Share Posted September 12, 2021 On 9/9/2021 at 7:37 PM, artpimpress said: Thank you for the solution to add css to create the accordion affect. We would like to have the first "tab" open. Any adjustment advice on this? https://prism-bluebird-55bf.squarespace.com/speaking password: bair Incorrect password. Can you check it again? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Amaya_SQSP Posted February 18, 2022 Share Posted February 18, 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 of the Accordion Block in our guide "Accordion blocks." 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