Elementor Premium Expand & Collapse Toggle

Elementor Premium Expand & Collapse Toggle

Element.How also offers premium tutorials! Check them here:

Table of Contents

In this tutorial you are going to learn how to create very nice, yet very powerful Elementor expandable elements. It works for text editor elements, image elements, and even container elements.

It works really well with Elementor dynamic data.

See the demo here:

Please purchase access and be logged in to access this template.

Visit the demo page directly.

Features:

  • Works with dynamic data
  • Works for as many Elementor expandable elements as you need
  • Individually set "read more" and "read less" messages of your choice
  • Works with any element. Expand and collapse images too, or even whole containers!

Let's get started!

First, let's copy paste this code in your project

This is a premium tutorial. Purchase access to unlock the full tutorial.

Access tutorial

$29/one time Purchase access

Includes

  • Gain Access to This TutorialUnlock complete access to the current tutorial: Elementor Premium Expand & Collapse Toggle
  • Future UpdatesYou will get access to all future updates to this tutorial.
  • Enjoy Unlimited UsageUse on as many of your own sites or your clients sites as you wish.

    Note that reselling or redistributing is not permitted.

Access everything

$299/one time Purchase All Access

Includes

  • Unlock every premium tutorial on Element.howGet access to the entire library of premium tutorials on Element.how
    Preview premium tutorials
  • Get access to the CSS course for Elementor usersAccess the complete 14 HTML chapters, 30 CSS chapters and 7 Elementor Projects.Learn more
  • Simple CSS Grid For ElementorAn Elementor Addon to Create Awesome Grid Layouts in a Single Click for Containers, Galleries and Loop Grid. Learn more
  • free extra: ShapeDividers.com Premium AccessLifetime Premium Access to ShapeDividers.comVisit ShapeDividers.com
  • 30 day money backNo questions asked money back. Not what you expected? Get a refund.
  • One-time payment of only $299No hidden fees or subscriptions.

    Sales taxes added where applicable.
  • Great supportGet help when you need it. Support includes getting things working as intended.

    Support excludes customization work.
  • Lifetime access to everything Element.howThe price reflects what is currently available on Element.how. All future updates are included, but none are promised. You pay for what is available now, and the rest is a sweet extra.

    I will say that it is definitely my intention to keep adding tutorials to Element.how.
* All prices are USD. Applicable taxes will be charged at checkout. Have a question? See the FAQ or email me.

Element.how also provides premium tutorials showing awesome advanced designs, check them out here.

Looking for something else? Search across 2737 Elements right here:

Checkout the Elementor Addon Finder directly

21 Responses

  1. Worked perfectly. Don't forget to remove the paddings at the top and bottom of the sp-expandable container, otherwise a part of the container will be displayed despite the defaultPreviewHeight = "0px" setting.
    Thanks for the great feature 🙂

    1. Hey Fabian!

      Yes indeed, need to be careful with top and bottom padding here... otherwise the height won't be what you expect it to be!

      Cheers!

  2. Hi Maxime, thanks again for another great feature. How do I achieve the chevron icons that rotate when View More / View Less is clicked?

    1. Hey Gideon!

      I updated the code recently and this should now work again as expected!

      Please import the updated code to your project.

  3. Hi Maxime, I am upgrading from 'Amazing Elementor Show Hide Section Button' tutorial, as I have switched to containers that are nested.

    The overwrite settings for the text thats displayed within each toggle button doesn't appear to be working for me however when set under Advanced > Attributes.

    When I set the following in Advanced > Attributes for each button, only the text set within the code snippet appears?

    data-expand-text|Custom Text Expand
    data-collapse-text|Custom Text Collapse

    Also not getting the rotate icon feature, as I had working before with the previous tutorial.

    Are you able to verify these are working? Thanks!

    1. Hey James,

      Could you share with me the URL of the page where you are testing this? I will have a look what's going on!

      Cheers

      1. Hi Maxime,

        Thanks for your reply - the updated code now works great! Thanks again!

        James

    1. Hey Stefan!

      I think it should be working for these already. Columns might be a bit buggy though... Sections should work.

      Have you tried? If you have tried and have issues, please share your page with me I will check.

  4. Thanks for the code. Is it possible to change the transparency value that appears on the button and the hidden content? And eliminate it altogether?

    1. Hi Simone,

      changing the value of "black 70px" to 0px inside <style> in all instances of the code did it for me. I'm pretty sure there is a cleaner way to do this though.

      Kind regards.

  5. Hi Maxime,

    great tutorials as always. This would be awesome for my project, I even added a bit of code that removes the button after expanding (collapsing and scrolling to top was a bit pointless to my project).

    However I had to remove everything because it has a glitch that happened by accident, but once you see it, you cannot unsee it. On mobile (tested with chrome, firefox and opera), if you scroll up and down (just enought for the browser adress bar to hide/show) the content will snap upwards / downwards, sometimes even skipping whole sections, sometimes skipping everything to the footer or header.

    I thought maybe I had some other code conflicting, so I tested on your own template (https://templates.element.how/elementor-premium-expand-collapse-toggle-template/) and it happens too.

    My theory is that this is related to the hide/ show of the adress bar of the browser app.

    Kind regards.

    1. @ Edit: removing this part of the code fixed the snapping for me:

      window.addEventListener('resize',function(){
      e.style.removeProperty('height');
      expandedHeight = e.offsetHeight + "px";
      if (!toggled){
      e.style.height = height;
      } else {
      e.style.height = expandedHeight;
      }
      })

      plus adding

      expandToggle.style.display = 'none'; /*after expandToggle.classList.add('expanded-text');*/

      to remove the button after expanding, made it tip top perfect. Now I just need to clean up parts of the code that i'm not using without breaking it 😀

      1. Thanks Joao for making me aware of this!

        I updated the resize code to ignore the URL bar on mobile.

        Cheers!

  6. Hi Maxime,
    can you stack the expander?

    I would like to depict the following scenario:

    1. Inner container consisting of several box elements, each with a read more button (works great with your code!)
    2. External container that I want to use to display the top row of boxes and hide the boxes underneath. By clicking on Read more, the inner container opens.

    If I give the parent container the 'sp-expandable' class according to the same scheme, it works, but ONLY if the Read more button in the navigator is located hierarchically above the inner container. However, I would like to place this underneath.

    Cheers
    Chris

    1. Greetings Christopher!

      Do you have by any chance a link to the page where you are testing this?

      That would help me understand better what's needed here to make it work!

      Cheers!

    1. Greetings Joachim!

      Ignore my other answer you might have received by email.

      I updated the JavaScript in the tutorial, please import the code from the tutorial again and let me know if that fixes it.

      Cheers!

Leave a Reply