css:<style>    /* 公共弹出层 */    .popWrap{position: fixed;left: 0;top: 0; width: 100%;height: 100%;z-index: 1000000;}    .popMask{width:100%;height:100%;background-color:#ddd;filter:Alpha(opacity=50);-moz-opacity:0.5;opacity:0.5; }    .popMask iframe,.popMain .popCont iframe{ width: 100%;height: 100%;border: 0 none; }    .popMain{ position: absolute;left: 50%;top: 50%;background-color: #fff;z-index: 1000001; border: 1px solid #2d2d2d;}    .popMain .popTit { background-color: #2d2d2d;color: #fff;font-size: 12px;height: 28px;line-height: 28px;padding-left: 12px;padding-right: 12px;}    .popMain .popTit .close{ font-family: iconfont; font-size: 12px;cursor: pointer;color: #fff; }    .popMain .popTit .close:hover{ color: #fff; }    .popMain .popCont {}    .popMain .popCont .popLoading { margin: 10px ;}</style>

html:

<button id="btnAdd" class="add">添加</button><div id="popup" style="display: none;">    <div class="popLoading">加载中...</div>    <h1>welcome</h1>    <button id="btnOpen">打开</button>    <button id="btnCancle">取消</button></div><div class="popup1" style="display: none;">    <h1>hello world</h1>    <button id="btnOpen1">打开1</button></div><iframe src="" frameborder="0" scrolling="0" id="iframe" style="display: none;"></iframe>

<script>
$(function(){

    $(".add").click(function(){        $("#popup").popShow({            url : "",            title : "编辑",            width : 800,            height: 700        });    });

    $("#btnOpen").delegate("","click",function(){        $(".popup1").popShow({            url : "",            title : "编辑111111",            width : 600,            height: 500        });    });

    $("#btnOpen1").delegate("","click",function(){        $("#iframe").popShow({            url : "https://www.baidu.com",            title : "详情页"        });    });

});
</script>以下为插件内容:

(function($){

$.fn.popShow = function (opitons) {     var defaults = {         url: "",         title: "",         width: "800",         height: "600"     };     var settings = $.extend({}, defaults, opitons);     this.each(function () {         var tac = $(this),             url = settings.url,             title = settings.title,             width = settings.width,             height = settings.height;         var tag = $('<div class="popWrap"><div class="popMask" ><iframe scrolling="no"src="about:blank"></iframe></div><div class="popMain" style="width: ' + width + 'px;height: ' + height + 'px;margin-left:-' + width / 2 + 'px;margin-top:-' + height / 2 + 'px"><div class="popTit"><a class="close fr"></a><span>' + (title ? title : '') + '</span></div><div class="popCont"></div></div></div>').appendTo("body");

         tag.find(".close").click(function () {             tac.popHide();         });         tag.find(".popCont").append($(this).show());         if ($.trim(url).length != 0) {             tac.prop("src", url);         }         return this;     }); }; //关闭弹窗 $.fn.popHide = function () {     var tab = $(this).closest('.popWrap');     $(this).hide().appendTo('body');     tab.remove();     return this; };

})(jQuery);

最新文章

  1. rsa 签名 加密解密
  2. 【转】Sqlite 混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该...
  3. vim的使用
  4. 原生javascript模仿win8等待进度条。
  5. Android SurfaceView vs TextureView
  6. ssh 命令行通过私钥登录其它设备
  7. (Android学习系列)一,用按钮实现时间的显示
  8. DOM in Angular2
  9. 根据WSDL生成代理类方式
  10. winform 菜单项显示历史记录 分类: WinForm 2014-07-11 18:15 196人阅读 评论(0) 收藏
  11. 《JS权威指南学习总结--开始简介》
  12. iOS应用程序工程文件以及启动流程
  13. 少侠学代码系列(二)-&gt;JS实现
  14. webpack之loader和plugin简介
  15. weblogic 下异常 org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken
  16. Scss基础用法
  17. javascript 获取html元素的三种方法
  18. form表单转化json对象
  19. wpf 窗口最小化后,触发某事件弹出最小化窗口并置顶
  20. java自定义类

热门文章

  1. 【MyBatis学习04】mapper代理方法开发dao
  2. 应用phpexcel导出excel文件后打不开的问题解决方法
  3. es迁移索引数据合并
  4. c++ 类内部 使用 new delete
  5. eclipse Alt+/ 无法提示代码
  6. spring boot中 使用http请求
  7. c++ [wrong]simple &quot;Garbage Collector&quot;
  8. What is the difference between application server and web server?
  9. 通知:spark meetup 第六次会议在北京举行
  10. 基于 UML 的业务建模举例