sobox 是一款非常实用的,基于 jQuery 的弹窗控件。
功能非常完整,而代码量又非常少(压缩完仅8k不到)的一款弹窗控件,
如果你熟悉ext的弹窗控件,那么sobox的使用对你来说应该是愉悦而完全没有压力。

引入sobox文件

  1. <link type="text/css" rel="stylesheet" media="all" href="style.css" />

  2. <script type="text/javascript" src="jquery1.9.1.min.js"></script>

  3. <script type="text/javascript" src="jquery.sobox.js"></script>


使用方法

  1. $('.a-tip').click(function () {

  2.     $.sobox.tip({

  3.         content: '爱看不看,上面提示一下~'

  4.     });

  5.     return false;

  6. });


sobox 基本参数  下载

  1. //通用方法

  2. $.sobox.pop({

  3.      /* 弹出类型及类型参数 */

  4.     type : 'content', // 弹窗内容模式:'content','target','ajax','iframe',每个模式分别对应每个参量

  5.     target : null, // target方式,target目标,如 '.detail','#contbox'

  6.     content : null, // content方式,支持html

  7.     iframe : null, // iframe方式,值为iframe目标页链接,如:http:// www.baidu.com/

  8.     ajax:{url:null,data:null,callback:function(){}}, // ajax事件

  9.  

  10.      /* 位置信息 */

  11.     posType:'center', // 'center,win,doc,tc,bc' 位置类型,居中 / 距window顶部 / 距离doucment顶部定 / top水平居中 / bottom水平居中,默认居中

  12.     pos:[0,0], // [x,y] 距离document左上角坐标,set模式使用

  13.     offset:[0,0], // [x,y] 弹窗相对本来设定位置偏移量,center模式只改变y轴

  14.  

  15.      /* 自定义参数 */

  16.     cls : null, // 添加自定义类名

  17.     width:360,height:null, // 宽高属性,iframe模式下,height为iframe高度

  18.     defaultShow:true, // 直接显示pop

  19.     visibility:true, // 默认pop执行后显示(用于部分复杂处理场景)

  20.     title : '提示', // 默认标题

  21.     showTitle:true, // 标题栏隐藏:默认显示

  22.     showMask : true, // 显示遮罩

  23.     drag :true, // 是否可拖动

  24.     maskClick : true, // 点击背景关闭内容

  25.     btn : [], // {cls:,text'确定',link:,removePop: true,callback:}

  26.  

  27.      /* 返回事件 */

  28.     beforePop:function(){}, // 弹窗打开之前callback事件

  29.     onPop: function(){}, // 页面打开callback事件

  30.     closePop: function(){} // 点击标题关闭按钮返回事件

  31. });

  32.  

  33. btn参数说明:

  34.  

  35. 默认每个btn元素由一个.a-sopop-btn a元素内置一个.s-sopop-btn span元素组成,

  36.  

  37. {

  38.      cls:null, // 添加类名

  39.      text:'确定', // 默认按钮文字

  40.      link:'#', // 为a添加链接,添加链接后,按钮返回链接指向地址

  41.      removePop: true, // 默认点击按钮关闭弹出层

  42.      callback:function (removePop){} // 返回事件

  43. }