Sharepoint Web Part tabbing

<!-- Reference the jQueryUI theme's stylesheet on the Google CDN. Here we're using the "Start" theme -->
<link  type="text/css" rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/themes/start/jquery-ui.css" />
<!-- Reference jQuery on the Google CDN -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<!-- Reference jQueryUI on the Google CDN -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>

<script type="text/javascript">
     jQuery(document).ready(function($) {
         //Put the Web Part Title for all the Web Parts you wish
         //to put into the tabbed view into the array below.
        WebpartTabs(["Web Part Title 1","Web Part Title 2"]);
    });

    function WebpartTabs(webPartTitles)
    {
        for(index in webPartTitles)
        {
            var title = webPartTitles[index];
            $("#WebpartTabs").append('<li><a href="#Tab'+index+'">'+title+'</a></li>').after('<div id="Tab'+index+'"></div>');
            $("span:contains('"+title+"')").each(function(){
                if ($(this).text() == title){
                   var webPart = $(this).hide().closest("span").closest("[id^='MSOZoneCell_WebPart']").contents();
                   $("#Tab" + index).append((webPart));
            }});
        }
        $("#tabsContainer").tabs();
}
</script>
<div id="tabsContainer"><ul id="WebpartTabs"></ul></div>

Comments

Popular posts from this blog

Clearing the Configuration Cache for SharePoint

SharePoint 2013 REST API CRUD Operations

Add List Item Attachments to Task Form using Nintex Workflow and Forms