zoukankan      html  css  js  c++  java
  • how to add Javascript and CSS in page layout with sharepoint 2013

    how to add Javascript and CSS in page layout with sharepoint 2013

    Sometimes, we need create a custom page layout, at the time, if we want to add some javascript and css code, how to do it? we cannot add the code in page layout file directly, the syetem will  filter it and the code lost function. follow my steps to resolve it.

    1. Open the page layout file, it is html file

    2. you must add the javascript and css under the label  <!--MS:<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server">-->. find the label

      <!--MS:<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server">-->
    
       <!--ME:</asp:ContentPlaceHolder>-->
    

    3. You need handle your css label when add css label, or the css will be filter, the correct css label is :

     <!-- MS:<style type="text/css" >-->
     
    
    // add your css code
    
    <!--ME: </style>-->

    4. Add javascript code, but you need focus on the document.ready, the document.ready will lost function for page layout is heriting from master page, so the body loading is difference. you must use the function named "_spBodyOnLoadFunctionNames.push"

     <script>
    
      _spBodyOnLoadFunctionNames.push("cutomFunction");
    function cutomFunction(){
    // ...
    }
    
    
    </script>


    Besides, we need hdie the master page in dialog,you have to add extra class in matser: <div class="s4-notdlg">this section won't </div>。

    and you can add new app in custom master page, you need to add the follow control in s4-workspace:

    <div style="display:none;">
                            <!--SPM:<SharePoint:AjaxDelta id="DeltaPlaceHolderLeftNavBar" BlockElement="true" runat="server">-->
                            <!--SPM:<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server">-->
                            <!--SPM:</asp:ContentPlaceHolder>-->
                            <!--SPM:</SharePoint:AjaxDelta>-->
                            <!--SPM:<SharePoint:AjaxDelta id="DeltaPlaceHolderPageTitleInTitleArea" runat="server">-->
                            <!--SPM:<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server">-->
                            <!--SPM:</asp:ContentPlaceHolder>-->
                            <!--SPM:</SharePoint:AjaxDelta>-->
                        </div>


     

  • 相关阅读:
    上手 WebRTC DTLS 遇到很多 BUG?浅谈 DTLS Fragment
    亮相 LiveVideoStackCon,透析阿里云窄带高清的现在与未来
    会议更流畅,表情更生动!视频生成编码 VS 国际最新 VVC 标准
    如何用 Electron + WebRTC 开发一个跨平台的视频会议应用
    理论 + 标准 + 工程 —— 阿里云视频云编码优化的思考与发现
    遍历哈希表
    sql语句的循环执行
    一个aspx页面里所有的控件
    SELECT DISTINCT 语句
    100 The 3n + 1 problem
  • 原文地址:https://www.cnblogs.com/wgwyanfs/p/7191243.html
Copyright © 2011-2022 走看看