3

Is there a way to place a lot of Content Editor Web parts on a page in minimized form allowing the user to expand and collapse them?

The controls in each webpart suggest this can be done but the control doesn't appear on each control when the page is published?

3
  • check this sharepoint.stackexchange.com/questions/25682/…
    – Waqas Sarwar MVP
    Commented May 16, 2015 at 8:06
  • Will this work on 2013, I am a power user and not a programmer, not sure if you need to amend the script with a reference to every webpart being used - I will have 12 CEWPs on the page as it's a list of offices. Expand each one and you will see the office details.
    – Razzmos
    Commented May 16, 2015 at 8:13
  • check my answer i think using jscript will fix it.
    – Waqas Sarwar MVP
    Commented May 16, 2015 at 8:13

1 Answer 1

6

If you want to expand and collapse web part in SharePoint 2013, there is a solution as follows:

  1. Find the classes of div tags of title and content of this web part using IE developer(F12), in my environment, they are like ms-webpart-chrome-title and ms-wpContentDivSpace.

  2. Then use the script below to expand and collapse your web part:

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    
    <script type="text/javascript">
    
    jQuery(document).ready(function() {
       jQuery(".ms-wpContentDivSpace ").hide();
       //toggle the component with class msg_body
       jQuery(".ms-webpart-chrome-title ").click(function(){
          jQuery(this).next(".ms-wpContentDivSpace ").slideToggle(500);
       });
    });
    </script>
    
  3. Then when we click the title of the web part, it will expand or collapse.

Expanding and Collapsing Webparts in SP 2013

Minimize webparts in SharePoint 2013

1
  • (the first link here has become a dead link..., removed by Microsoft I guess)
    – Tally
    Commented Aug 7, 2023 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.