Okay
  Public Ticket #2239852
How to expand/collapse a toggle panel from a button click
Closed

Comments

  • rley started the conversation

    Hi,

    I would like a row hidden (collapsed) by default, and have it expand (slide down, animated) when a button is clicked.  A toggle panel might work (if I can hide the title section) but what do I add to the button click url?
    The (minimal!) toggle-panel instructions say "Can also be linked to by adding ?toggle=your-toggle-name onto your URL", but I'm not sure that does what I want.

    When they click the button, it should toggle the panel, but #?toggle=my-toggle doesn't seem to do anything.  Is this possible?  Or do I need to add some custom jquery to my page?


    Thanks!

  •  8,992
    Tahir replied

    Hey Again,

    Yes you will have to use a Toggle Page Element however it is limited as in it cant have any dynamic Page Element inside it. 

    You can link to a Toggle using a button though you will have to specific a scroll anchor as well. 

    Please create a test page so i can explain this further if needed and provide the wp-admin login details for it. 

    Best 


    ThemeNectar Support Team 

  • rley replied

    Thanks - I actually JUST found a solution! ...

    I added css display:none to the row I want to toggle(id:about-the-test), then added some RAW JS in a section just below my button (id: toggle-more-test), with '#' as the url for the button.  Seems to work!

    <script>
    jQuery("#toggle-more-test").click(function(){
      jQuery("#about-the-test").slideDown();
    });
    </script>