Jump to content

ejeancross

Circle Member
  • Posts

    0
  • Joined

  • Last visited

Reputation Activity

  1. Like
    ejeancross reacted to colin.irwin in How do I create hide/show text on a page, like you see with FAQs?   
    Here's a slightly more concise solution, using jQuery.
    The idea is to use a Markdown block to hold your questions and answers. It should be the only Markdown block on the page.
    The Markdown will look something like the following (The + at the start of each question is a cue for the user to know they can expand the entry).
    + This is a first question ----------------- This is the first line of an answer to the question above. This is a second line of the answer. * Bullet points * Can be used too + This is a second question ----------------- This is a one line answer to the question above.
    Questions should be styled as H2.
    Then put the following code into your page's injection point:
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/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();}); }); </script>
    The first can be omitted if you already have a link to jQuery in your sitewide code injection point.
    The second script tells the mouse cursor to become a pointer when over the Markdown H2s - this is to tell the user it's clickable. Then, when an H2 is clicked it toggles the visibility of all content between the clicked H2 and the next H2 / the end of the markdown block.
    See it in action here - http://www.silvabokis.com/idea-testing/
  2. Like
    ejeancross reacted to colin.irwin in How do I create hide/show text on a page, like you see with FAQs?   
    It does. I liked your solution but thought that a Markdown block to contain the FAQs would be easier for a non-technical person to maintain.
    There's still some know-how required but the tools inside the Markdown editor make it relatively straightforward to maintain.
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.