Jump to content

Hide/Show Content Description Text

Recommended Posts

Hi! I'm looking for a way to hide/expand a long description within a content item's description on our team's reviews page. I've found code for expanding FAQs and accordion style, but not within a text block like this. Ideally, I'd like to make the large chunk of text show only the first paragraph and then expand if the reader would like to read more. Thanks!

Screenshot 2023-10-03 at 3.22.55 PM.png

Link to comment
  • 2 weeks later...
  • 2 months later...

I used to do similar with List Section, my ideal is to add this

image.thumb.png.7c1ce5ad893fefc321f5fb1a0dd2c1b3.png

the add this code to Page Header Code Injection to enable more info when users click Read Bio text

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
 $('li.list-item').each(function(i, e) {
      $(this).click(function() {
  $(this).toggleClass('tp-list-des-open');
});
 })
});
</script>
<style>
.list-item-media:hover, h2.list-item-content__title:hover {
    cursor: pointer;
}
  .list-item-content__description {
    height: 0;
    overflow: hidden;
    transition: all 0.1s ease;
}
  .tp-list-des-open .list-item-content__description {
    height: 100%;
    transition: all 0.1s ease;
}
  h2.list-item-content__title:after {
    content: "Read Bio";
    display: block;
    font-size: 14px;
    font-style: italic;
    margin-top: 20px;
}
  .tp-list-des-open h2.list-item-content__title:after {opacity:0;}
</style>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • 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.