[How-to] Create a Collapsible Page Section



Show first post

105 replies

Yes, there is. Just copy the script in another Javascript section. Afterwards you need to replace the variable names for section, box and button -> not only at the top, but also in the whole script!
E.g.:

var toggleSection2 = $(’#lp-pom-block-99’);

var toggleContent2 = $("#lp-pom-box-100");

var toggleButton2 = $("#lp-pom-button-103");

Badge +1

Hey @maxl, would you be able to share what parts need edited if there’s more than one drop down? I can’t seem to get it to work properly.

Userlevel 6
Badge +4

Hi @maxl - what do you mean by “in the whole script”. Where else to change variables?

Hi @Finge,

what i did:

  1. Use the existing script in a Javascript TAB (CollapseJS_1)

  2. Set the variables accordingly within the script to your wishes “#lp-pom-…”

var toggleSection = (’#lp-pom-block-99’); var toggleContent = ("#lp-pom-box-100");
var toggleButton = $("#lp-pom-button-103")

  1. Add another Javascript TAB (CollapseJS_2)

  2. Paste the code of CollapseJS_1 there

  3. Replace the variable itself in the whole script - not only at the top…!
    var toggleSection2 = …;
    var toggleContent2 = …;
    var toggleButton2 = …;

  4. Set the variables to the desired part of your page

Hi @maxl, I tried this solution and it worked half ways.
Do I need to change only “toggleSection”, “toggleContent”, “toggleButton” every time they appear or other properties like “sectionHeight”, “toggleContentTop2” …?

Is there a way to do this but with multiple sections?

Has anyone had luck making this script work for more than one element? Unbounce has an example page that uses 3 but mine only works with one button and section.

Hello. I know its been a while since the code was put here, but I just got around to using it and I have 1 problem. The collapsible part works, but the sections underneath it don’t move accordingly. Instead of a clean section going up and down, I have a big blank space that fills when I click the button. Any ideas where I went wrong?

Thank you!

Hi there, the button will open the panel but does not collapse the panel back down on the mobile version? Is it not supposed to do this on both desktop and mobile?

Is there an unbounce template that has this built in? Tried to figure this out for myself with zero luck.

Hey,

@Noah @maxl I tried your tipp for more than one collapsible page section but it isn’t working correctly. Do you have an example for your solution?

Hi, i checked out your code for collapsible panels, but did not manage to make it work… : i added the HTML in a html block on the page section and I added the CSS to the CSS, below the page… yet it just shows the text…

Can you advise? Thx

Userlevel 5
Badge +2

Hi @MyWellCare_Deutschla!

Could you send a link to your page? Feel free to send me a private message if you’d like!

Thank you,
Caroline

Hi,
Would anybody who has done this for multiple sections be able to provide a link to their page to see well it works. I got it working for the page as it was very useful.

Can you setup an if/else if you had multiple sections in the JS code.

Thanks in advance.

Regards,
Ryan

Is there any way to launch the collapsible section other than a link?

Ideally, could you launch it when someone scrolls to a certain point on the page?

Just wondering if you ever figured this out? I’m having the same issue.

Exactly what I’m looking for! However, when the sections expand, they are overlapping the text/section below. Is there a fix for this? I hope?! 🙂

Hi Noah,

I was also checking the site out: http://landingpage.noahmatsell.ca/collapsible-section/
and it seems to have the same problem as mine. When you resize the browser the content overlaps at the bottom.

If you see on my web page: http://unbouncepages.com/testing-quote-14/
When I make the browser window as narrow as possible the content overlaps.

Is there any way to fix this?

Thanks!

Userlevel 7
Badge +1

Hi Sam,

In this post @webim shared an excellent workaround for a collapsible page section. It might be worth getting in touch with them to see if you need further assistance. But in the meantime, give this a read and see if it helps. 🙂

Hi @Noah, I am seem to encounter an issue in which the collapsible section, when opened, does not push the fixed section below it further down, but rather overlaps over it. In addition, it causes a footer we use on every page on our domain to go haywire and jump to the middle of the page. Any help would be appreciated!

Anyway I can hide the the button - in this case “Show Speakers” after it has been clicked once?

Hi @Noah I’m having the same issue. The footer (which is the section below our collapsible FAQ section) is not moving, so it’s overlaid on top of the collapsible section. Any workarounds?

Is the written text within the collapsible section crawled by Google?

Hi,
I did everything and put the JS code - but it’s not working… where can I find more help for how to install a collapsible section in Unbounce ?

this works great on the desktop version, but can’t get it to work on mobile…any ideas what the issue may be?

Reply