使用前需包含以下jquery.js、bgiframe.js、weebox.js、wee.css檔案
基本用法舉例如下: $.weeboxs.open('#testbox', {title: 'hello world', width:400, height: 200});
$.weeboxs.open('The operation failed.',{
onopen:function(){alert('opened!');},
onclose:function(){alert('closed!');}, onok:function(){alert('ok');
$.weeboxs.close();} });
$.weeboxs.open('/modules/test/testsession.php', {contentType:'ajax'});
$.weeboxs.open('hello world');
$.weeboxs.open('The operation failed.',{type:'error'});
$.weeboxs.open('The operation failed.',{type:'wee'});
$.weeboxs.open('The operation failed.',{type:'success'});
$.weeboxs.open('The operation failed.',{type:'warning'});
$.weeboxs.open('Autoclosing in 5 seconds.', { timeout: 5 });
以下是預設選項:
boxid: null, //設定了此值只後,以後在開啟同樣boxid的彈窗時,前一個將被自動關閉
boxclass: null, //給彈窗設定其它的樣式,用此可以改變彈窗的樣式
type: 'dialog', //彈窗類型,目前有dialog,error,warning,success,wee,prompt,box六種
title: '', //彈窗標題
width: 0, //彈窗寬度,不設時,會自動依據內容改變大小
height: 0, //彈窗高度(注意是內容的高度,不是彈窗的高度)
timeout: 0, //自動關閉的秒數,設定此值後,視窗將自動關閉
draggable: true,//是否可以拖拽
modal: true, //是否顯示遮照
overlay: 75, //遮照透明度
focus: null, //彈窗開啟後,焦點移到什麼元素上,預設移到取消按鈕到
position: 'center',//彈窗開啟後的預設為中間,設定為element時,需要設定trager選項,
trigger: null, //顯示位置的參照元素,為一個元素id
showTitle: true,//是否顯示標題
showButton: true,//是否顯示按鈕,包括確定和取消
showCancel: true, //是否顯示取消按鈕
showOk: true, //是否顯示確定按鈕
okBtnName: '確定',//"確定"按鈕名稱
cancelBtnName: '取消',//"取消"按鈕名稱
contentType: 'text',//內容擷取方式,目前有三種text,selector,ajax
contentChange: false,//為selector時
clickClose: false, //點擊不在彈窗上時,是否關閉彈窗
zIndex: 999,//預設彈窗的層
animate: false,//效果顯示
onclose: null, //彈窗關閉時觸發的函數
onopen: null, //彈窗顯示前觸發的函數, 此時內容已經放入彈窗中,不過還沒有顯示出來
onok: null //點擊確定按鈕觸發的函數