jquery.sobox 經典版彈窗控件

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. }


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章