转:http://blog.csdn.net/tristan_dong/article/details/19076315

自定义弹出框

一. 项目需求: 自定义弹出框,包括弹出框的内容和样式。

说明: 母版页包括站点母版页和系统母版页,一般我们自定义的母版页只需应用到站点上,而弹出框应用的母版是系统母版,所以,如果你的站点自定义母版没有设置为系统母版,那么弹出框就会和你站点风格有差异,解决方法:设置你的自定义母版为系统母版或者修改弹出框样式。

二. 步骤:

1. 准备工作:

a. 点击按钮:这里用<a>标签:

  1. <a href="http://www.baidu.com" class="dialog-pop">Show Me the Pop-Up</a>
<a href="http://www.baidu.com" class="dialog-pop">Show Me the Pop-Up</a>

b. 弹出框内容:可以自定html文件,上传到sharepoint站点。这里我直接用“http://www.baidu.com”

c. 弹出框样式: 自定义CSS文件

  1. <style>
  2. .ms-dlgOverlay {
  3. background-color: #333;
  4. }
  5. .ms-dlgContent {
  6. border: 0;
  7. }
  8. .ms-dlgBorder {
  9. border: 1px solid #333;
  10. }
  11. .ms-dlgTitle {
  12. background-color: #333;
  13. }
  14. .ms-dlgTitleText {
  15. display: block;
  16. font-weight: bold;
  17. font-size: 13px;
  18. padding: 7px;
  19. }
  20. </style>
<style>
.ms-dlgOverlay {
background-color: #333;
}
.ms-dlgContent {
border: 0;
}
.ms-dlgBorder {
border: 1px solid #333;
}
.ms-dlgTitle {
background-color: #333;
}
.ms-dlgTitleText {
display: block;
font-weight: bold;
font-size: 13px;
padding: 7px;
} </style>

d. js代码:我重写OpenPopUpPage方法,给jQuery库添加自定义函数sharePop,方便以后直接调用。

注意:原本只需简单的调用该方法就可以实现同样的效果,如下蓝色字体

//  <a href="javascript:OpenPopUpPage('http://www.baidu.com');">Show Me the Pop-Up!</a>

  1. <script>
  2. (function($){
  3. $.fn.sharePop = function(){
  4. if(typeof OpenPopUpPage == 'function'){
  5. return this.each(function(i){
  6. if($(this).attr('href') != null){
  7. $(this).click(function(e){
  8. e.preventDefault();
  9. OpenPopUpPage($(this).attr('href'));
  10. });
  11. }
  12. });
  13. }
  14. else{
  15. return false;
  16. }
  17. };
  18. })(jQuery);
  19. $(document).ready(function(){
  20. $('.dialog-pop').sharePop();
  21. });
  22. </script>
<script>
(function($){
$.fn.sharePop = function(){
if(typeof OpenPopUpPage == 'function'){
return this.each(function(i){
if($(this).attr('href') != null){
$(this).click(function(e){
e.preventDefault();
OpenPopUpPage($(this).attr('href'));
});
}
});
}
else{
return false;
}
};
})(jQuery);
$(document).ready(function(){
$('.dialog-pop').sharePop();
});
</script>

e. 调用实例:

  1. $(document).ready(function(){
  2. $('.dialog-pop').sharePop();
  3. });
$(document).ready(function(){
$('.dialog-pop').sharePop();
});

三. 结果演示:







四. 源码

注意:只需把下面代码加入Script Webpart即可

  1. <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"></script>
  2. <script>
  3. (function($){
  4. $.fn.sharePop = function(){
  5. if(typeof OpenPopUpPage == 'function'){
  6. return this.each(function(i){
  7. if($(this).attr('href') != null){
  8. $(this).click(function(e){
  9. e.preventDefault();
  10. OpenPopUpPage($(this).attr('href'));
  11. });
  12. }
  13. });
  14. }
  15. else{
  16. return false;
  17. }
  18. };
  19. })(jQuery);
  20. $(document).ready(function(){
  21. $('.dialog-pop').sharePop();
  22. });
  23. </script>
  24. <style>
  25. .ms-dlgOverlay {
  26. background-color: #333;
  27. }
  28. .ms-dlgContent {
  29. border: 0;
  30. }
  31. .ms-dlgBorder {
  32. border: 1px solid #333;
  33. }
  34. .ms-dlgTitle {
  35. background-color: #333;
  36. }
  37. .ms-dlgTitleText {
  38. display: block;
  39. font-weight: bold;
  40. font-size: 13px;
  41. padding: 7px;
  42. }
  43. </style>
  44. <a href="http://www.baidu.com" class="dialog-pop">View Content</a>
  45. <br/>


SharePoint 2013 Pop-Up Dialogs的更多相关文章

  1. [转]Installing SharePoint 2013 on Windows Server 2012 R2

    转自:http://www.avivroth.com/2013/07/09/installing-sharepoint-2013-on-windows-server-2012-r2-preview/ ...

  2. Fix Internet Explorer Crashes with SharePoint 2013 Online Presence Indicators

    IE中,只要是鼠标浮动到人名字上面的状态的时候,这个状态是与Lync相连接的,IE就会出现停止工作. 以下是解决方法. Until the other day when I figured this ...

  3. SharePoint 2013 create workflow by SharePoint Designer 2013

    这篇文章主要基于上一篇http://www.cnblogs.com/qindy/p/6242714.html的基础上,create a sample workflow by SharePoint De ...

  4. Install and Configure SharePoint 2013 Workflow

    这篇文章主要briefly introduce the Install and configure SharePoint 2013 Workflow. Microsoft 推出了新的Workflow ...

  5. SharePoint 2013 configure and publish infopth

    This article will simply descript how to configure and publish a InfoPath step by step. Note: To con ...

  6. 沙盒解决方案解决SharePoint 2013 以其他身份登陆的问题

    众所周知,SharePoint 2013没有像SharePoint 2010那样有一个叫"以其他身份登录"的菜单项. 当然解决方案也很多,比如你可以直接修改Welcome.ascx ...

  7. 实现一个基于 SharePoint 2013 的 Timecard 应用(中)

    门户视图 随着 Timecard 列表的增多,如何查找和管理这许多的 Timecard 也就成了问题.尤其对于团队经理而言,他除了自己填写的 Timecard,还要审核团队成员的 Timecard 任 ...

  8. 实现一个基于 SharePoint 2013 的 Timecard 应用(上)

    在 SharePoint 2013 上面实现一个 Timecard 应用的想法来自一个真实的需求,而实现的方案在我脑海里面盘旋已经很久了,终于这几天准备安排点儿时间将它实现出来. “ We start ...

  9. SharePoint 2013 Designer 入门教程

    SharePoint的使用中,SharePoint Designer是非常重要的工具,我们可以通过Designer设计页面.母版页,维护.管理站点,也可以定制列表表单.数据视图,设计工作流等等.下面总 ...

  10. SharePoint 2013 开发教程

    做了SharePoint有三年了,大家经常会问到,你的SharePoint是怎么学的,想想自己的水平,也不过是初级开发罢了.因为,SharePoint开发需要接触的东西太多了,Windows操作系统. ...

随机推荐

  1. 三类,23种设计模式,速记理解法!PHP

    一,创建型设计模式 1.FACTORY—追MM少不了请吃饭了,麦当劳的鸡翅和肯德基的鸡翅都是MM爱吃的东西,虽然口味有所不同,但不管你带MM去麦当劳或肯德基,只管向服务员说“来四个鸡翅”就行了.麦当劳 ...

  2. nginx低版本不支持pathinfo模式,thinkphp针对此问题的解决办法

    将一个thinkphp项目从apache环境移到nginx1.2上,怎奈,nginx这个版本默认不支持pathinfo模式 首先,编辑nginx的虚拟主机配置文件 location ~ .*.(php ...

  3. 微信支付配置信息,JSAPI接口,H5调用微信js接口支付,微信公众号支付

    微信支付已经做完了,没接触过微信的我,经历了非常艰难的3天,才把微信支付给做出来,对于专业的人来说,估计就是一小时就搞定的事情了,虽然说做了很长时间,但是确实也学到东西了,也收获了不少,下面跟大家分享 ...

  4. R语言编程艺术# 数据类型向量(vector)

    R语言最基本的数据类型-向量(vector) 1.插入向量元素,同一向量中的所有的元素必须是相同的模式(数据类型),如整型.数值型(浮点数).字符型(字符串).逻辑型.复数型等.查看变量的类型可以用t ...

  5. 使用Yeoman搭建 AngularJS 应用 (7) —— 让我们搭建一个网页应用

    原文地址:http://yeoman.io/codelab/preview-inbrowser.html 开启你的服务 运行Grunt任务,通过输入下面的命令来创建一个本地Node的http服务,地址 ...

  6. Cookie Session Cache

    二. 工作机制 Ø Cookie :采用的是客户端保存信息的方案. Ø Session :采用服务器端保存信息的方案. Ø Cache :利用缓存 SRAM 来"静态"的保存写入信 ...

  7. 1305: [CQOI2009]dance跳舞 - BZOJ

    Description 一次舞会有n个男孩和n个女孩.每首曲子开始时,所有男孩和女孩恰好配成n对跳交谊舞.每个男孩都不会和同一个女孩跳两首(或更多)舞曲.有一些男孩女孩相互喜欢,而其他相互不喜欢(不会 ...

  8. hibernate添加数据,默认字段为null的问题解决

    数据库中的一个字段默认为0,但是在用hibernate的添加之后,默认字段竟然不是0,为NULL. 查了一下.发现想要让默认字段生效.需要在*.hbm.xml添加一些参数,如下.(红色部分) dyna ...

  9. -webkit-text-size-adjust: none;该如何处理

    -webkit-text-size-adjust: none; 在中文版Chrome里面,网页CSS里所有小于12px的字体设置都无效,最终将显示12px.这样弄的本意可能 是好的,因为中文一旦小于1 ...

  10. 【leetcode】Word Ladder (hard) ★

    Given two words (start and end), and a dictionary, find the length of shortest transformation sequen ...