Collapsible sections not working

Hi Support,

I’d like to implement collapsible section on my site, but despite trying pretty much every JS solution posted on the old forums I can’t get any success.

Effect I’m looking for:

User presses a button and a full size section expands below containing new content.

I tried this code in the JS editor (after giving the button, section ect the correct ID’s and classes), which looks like it SHOULD work:

    jQuery(document).ready(function($){
   $('#my-section.section-expandable').slideToggle(0);
   $('#my-section-trigger-button').click(function(e){
     e.preventDefault();
     $('#my-section.section-expandable').slideToggle( "slow" );
   });
});

Unfortunately all it does is hide the ‘’#my-section.section-expandable’ section before the page loads and when I press the button it just takes me to the top of the page. The section doesn’t appear or expand.

Do you have any suggestions?

Obviously all the code I tried are from posts which are over a year old - is this the reason they don’t work?

Thanks for the help,

Andy

Hi There,

Could you please provide us with your website URL so we can take a closer look?

Thanks.

Hey Thai,

The site URL is www.assetdrop.co but I currently don’t have any of the code running on it (because it didn’t work and I like to keep things clean).

Looking over the JQuery I put in my original post, assuming I have all the classes and IDs set properly, am I correct in believing that SHOULD work?

Thanks for your help,

Andy

Hi there,

There is nothing to check on your site, I don’t see it there. And it’s only normal that it will be hidden upon load since you have to click the button for it to display. Hence, the issue might be your button and it should have the ID of my-section-trigger-button. Plus, you said it takes you to the top when it’s clicked, which only means the click() is not properly binded to the button. Please check your browser console what error you’re getting.

Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.