Tab with web parts in Sharepoint 2013

Tab with web parts in Sharepoint 2013

Implement a feature about tabbing content with multiple web parts, each associated with a header in a list. I will achieve it in SharePoint 2013.

to tab select web parts, I can regared the web part zone as a div, and all the web parts should be single panel. here is my steps:

1. create a page layout

2. add a div as a container, In this div, append a div as a title to switch button

 <div class="sp-content-up">

            <div class="tab ms-webpart-titleText">

            </div>

            <div class="clear"></div>

            <div data-name="WebPartZone">
                <!--CS: Start Web Part Zone Snippet-->
                <!--SPM:<%@Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
                <div xmlns:ie="ie">
                    <!--MS:<WebPartPages:WebPartZone runat="server" AllowPersonalization="false" ID="x774799e39f4841a58494c7cdf6dd1b4f" FrameType="TitleBarOnly" Orientation="Vertical">-->
                    <!--MS:<ZoneTemplate>-->
                    <!--DC: Replace this comment with default web parts for new pages. -->
                    <!--ME:</ZoneTemplate>-->
                    <!--ME:</WebPartPages:WebPartZone>-->
                </div>
                <!--CE: End Web Part Zone Snippet-->
            </div>
 </div>

3. cretae a page using the new page layout, and add serveral web parts in the page.

4. add css and js using Script Edit web part in the new page

<script>
 $(document).ready(function(){
$(".sp-content-up .ms-webpart-titleText").find("span").each(function(){
if( this.innerHTML !="" && this.innerHTML !=undefined){
$(".sp-content-up .tab").append("<div class='tabtitle'>" + this.innerHTML + "</div>");
}
});

$(".sp-content-up .ms-webpart-chrome-title").hide();
 $(".sp-content-up .ms-webpartzone-cell:eq(0)").addClass("tabcontentshow");
            $(".tabtitle:eq(0)").addClass("tabtitleclick");
            $(".tabtitle").on("click", function () {
                var otherTitle = $(".tabtitle:not(.tabtitle:eq('" + $(this).index() + "'))");
                var otherContent = $(".sp-content-up .ms-webpartzone-cell:not(.sp-content-up .ms-webpartzone-cell:eq('" + $(this).index() + "'))");
                $(".sp-content-up .ms-webpartzone-cell:eq('" + $(this).index() + "')").addClass("tabcontentshow");
                $(this).addClass("tabtitleclick");
                otherContent.removeClass("tabcontentshow");
                otherTitle.removeClass("tabtitleclick");
            });
});

</script>
<style>
    .sp-content-up  .tabtitle{
font-size:13px !important;
}
        .tabtitle{
            float: left;
           margin-right:2px;
            width: 200px;
            height:30px;
            background-color: rgb(230, 230, 230);
            color: black;
            text-align:center;
            cursor:pointer;
            border-width:1px;
          border-color: gray;
          border-style: solid;
        }

        .tabtitleclick {
            background-color:white;
       border-bottom-color: white;
        }

         .tabtitle:hover {
            background-color: rgb(241, 241, 241);
        }

             .clear {
                clear: both;
            }

        .sp-content-up .ms-webpartzone-cell {
            display: none;
        }
        .sp-content-up   .tabcontentshow {
            display: block;
            color: white;
        }

 </style>

5. check the result, is that cool!?

时间: 2024-08-29 20:50:58

Tab with web parts in Sharepoint 2013的相关文章

sharepoint 2013 office web app 2013 文档在线浏览 IE11 浏览器不兼容解决方法

昨晚配置完成office web apps 2013的外部网络访问之后,今天发现了一个很奇怪的问题,就是IE 11不支持文档在线浏览,找了很多方法,打补丁什么的,都不管用,最后在预览文件的页面,看到<head>标签,里面有一句代码: <meta http-equiv="X-UA-Compatible" content="IE=99" /> 我把他改成了 <meta http-equiv="X-UA-Compatible&quo

sharepoint 2013 使用Office Web Apps 查看或编辑office文档时页面出现:“抱歉,出现了问题”错误

sharepoint 使用Office Web Apps 查看或编辑office文档时页面出现:"抱歉,出现了问题"错误 该问题是由于使用了系统账户登录站点而导致的. 更换其他账户登录问题解决. 其他错误还有下面的: 如果 Office Web Apps 在与 SharePoint 2013 结合使用时未正常工作,请查看以下症状并展开相应的标题以查找纠正步骤. 问题:当您选择 SharePoint 库中的"新文档"链接时,系统提示您上载某个文档而不是为您提供用于创建

SharePoint 2013实例1&mdash;构建三层服务器场8&mdash;配置WEB层

本节我们来进行WEB层的配置,如下图标红处. 服务器 主机名 内存 IP 前端服务器WFE#1 srv-wfe01 16G 192.168.5.75 前端服务器WFE#2 srv-wfe02 16G 192.168.5.76 1. 准备工作 和之前APP服务器一样,首先需要安装必备软件,然后再安装Sharepoint Server,最后进入产品安装配置向导. 2.安装WEB前端服务器 选择连接现有服务器场 选择数据库 输入场连接密码 点击高级设置 由于WEB前端服务器不承担管理中心的任务,所以这

BEGINNING SHAREPOINT&#174; 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序 WOPI和新的Office Web Apps Server

BEGINNING SHAREPOINT? 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序  WOPI和新的Office Web Apps Server 使用SP2013,微软对Office Web Apps采取了新的建设性的方法,并将服务与SP分离开来.

Sharepoint 2013 出现The tool was unable to install Application Server Role, Web Server (IIS) Role

在Windows Server 2012 R2环境下运行Sharepoint 2013前置运行软件发现会出现The tool was unable to install Application Server Role, Web Server (IIS) Role.这是因为R2版本操作系统中C:\Windows\System32下的ServerManagerCmd.exe不存在,但是它有一个ServerManager.exe这样的文件. 解决方案:将ServerManager.exe复制一份并重新

部署Office Web Apps Server并配置其与SharePoint 2013的集成

Office Web Apps Server 是新的 Office 服务器产品,它提供 Word.PowerPoint.Excel 和 OneNote 的基于浏览器的版本.单个 Office Web Apps Server 服务器场可支持通过 SharePoint 2013.Lync Server 2013.Exchange Server 2013.共享文件夹和网站访问 Office 文件的用户.Office Web Apps Server 适用于支持 WOPI(Web 应用程序开放平台接口协议

SharePoint 2013 创建web应用程序报错&quot;This page can’t be displayed&quot;

错误描述 This page can't be displayed ?Make sure the web address http://centeradmin is correct. ?Look for the page with your search engine. ?Refresh the page in a few minutes. 发生过程 创建web应用程序,填写完基本信息以后点击确定,就是"这不会花费很长时间"的提示,然后就报错了,并且SharePoint和iis的日志中

SharePoint 2013的限制(一)Web Application 和Content Database

Web Application 的限制 SharePoint 2013 Farm最大支持20个WebApplication.这个限制和Application Pool的限制无关,是对于整个Farm来讲的.微软建议把Web Application的数目控制的越小越好.如果想要多个不同名字的site,可以用创建host named 网站集来代替添加新的web application. 一个We Application最多支持5个Zone.这个是SharePoint定义死的,不可修改. 一个Web A

BEGINNING SHAREPOINT&#174; 2013 DEVELOPMENT 第3章节--SharePoint 2013 开发人员工具 SharePoint中基于Web开发

BEGINNING SHAREPOINT? 2013 DEVELOPMENT 第3章节--SharePoint 2013 开发人员工具 SharePoint中基于Web开发 之前提到过,定义SharePoint开发有多种方法.作为高级用户,你可能使用更多原生SharePoint功能在基于Web环境做开发.高级用户典型地在SharePoint站点有逐步上升的权限,并且能够完成以下任务: 创建和管理网站集与网站权限. 配置站点主题. 添加Apps到站点. 为网站中使用创建并部署多媒体. 配置和自定义