如何将Jquery添加到MasterPage 2013 [英] How to add Jquery to MasterPage 2013

查看:113
本文介绍了如何将Jquery添加到MasterPage 2013的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将jQuery添加到sharepoint 2013主页.我做了什么:

I'm trying to add jQuery to sharepoint 2013 master page. What I did:

1)

  • 将jquery-"jquery-1.11.1.min.js"复制到C:\ Program Files \ Common Files \ Microsoft Shared \ Web服务器扩展\ 15 \ TEMPLATE \ LAYOUTS.
  • 复制seattle.html并添加<!--SPM:<SharePoint:ScriptLink language="javascript" name="/_layouts/jquery-1.11.1.min.js" runat="server" Localizable="false" />-->
  • 将seattle.html上载为ASP NET MASTERPAGE
  • 发布它--->没有任何反应.到seattle.master时没有出现Sharepoint:Scriptlink
  • Copy jquery - "jquery-1.11.1.min.js" to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS.
  • Copy seattle.html and add <!--SPM:<SharePoint:ScriptLink language="javascript" name="/_layouts/jquery-1.11.1.min.js" runat="server" Localizable="false" />-->
  • Upload seattle.html as ASP NET MASTERPAGE
  • Publish it ---> Nothing happend. To seattle.master wasn't appear Sharepoint:Scriptlink

2)

  • 将jquery-"jquery-1.11.1.min.js"复制到SiteAssets.我的应用程序位于根网站集上,因此例如对jQuery的访问是

http://localhost/SiteAssets/jquery-1.11.1.min.js

  • 复制seattle.html
    • 添加!--SPM:<SharePoint:ScriptLink language="javascript" name="'~sitecollection/SiteAssets/jquery-1.11.1.min.js" runat="server" Localizable="false" />-->
    • 仍然无效
    • Copy seattle.html
      • Add !--SPM:<SharePoint:ScriptLink language="javascript" name="'~sitecollection/SiteAssets/jquery-1.11.1.min.js" runat="server" Localizable="false" />-->
      • Still no effect

      从开始到将Jquery添加到Sharepoint 2013的正确方法是什么?

      What is the correct way from begining to the add of adding Jquery to Sharepoint 2013?

      推荐答案

      可能您忘记应用自定义母版页,转到母版页设置"页,并将Site Master PageSystem Master Page设置为自定义母版页.

      Probably you forgot to apply custom master page, go to Master Page settings page and set Site Master Page and System Master Page to your custom master page.

      注意:第二个选项中有一个错字:name属性包含 '符号

      Note: there is a typo in the second option: name attribute contains ' symbol

      如何在SharePoint 2013主页中引用JavaScript文件

      假定以下情况:

      How to reference JavaScript file in SharePoint 2013 master page

      Assume the following scenario:

      • 具有相关HTML文件的自定义母版页helsinki.master是 用过
      • jQuery库jquery.min.js位于SharePoint Site Assets库中
      • a custom master page helsinki.master with associated HTML file are used
      • jQuery library jquery.min.js is located in SharePoint Site Assets library

      然后,为了在自定义母版页中引用jQuery库,使用以下步骤:

      Then, in order to reference jQuery library in custom master page the following steps are used:

      • 打开关联的HTML文件helsinki.html
      • 插入行<!--SPM:<SharePoint:ScriptLink language="javascript" name="~sitecollection/SiteAssets/jquery.min.js" runat="server" Localizable="false"/>-->
      • 发布helsinki.html
      • 转到母版页设置"页面并设置Site Master PageSystem Master Pagehelsinki.master
      • Open an associated HTML file helsinki.html
      • Insert the line <!--SPM:<SharePoint:ScriptLink language="javascript" name="~sitecollection/SiteAssets/jquery.min.js" runat="server" Localizable="false"/>-->
      • Publish helsinki.html
      • Go to Master Page settings page and set Site Master Page and System Master Page to helsinki.master

      关于系统母版页

      此站点上的管理页面,列表和文档库视图使用系统母版页"

      System Master Page is used by administrative pages, lists, and document library views on this site

      此方法已经在SharePoint 2013中进行了测试,并且对我有效.

      This approach has been tested in SharePoint 2013 and works for me.

      这篇关于如何将Jquery添加到MasterPage 2013的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆