默認的
new Dialog('這是一個默認對話框').show();
非模態對話框
new Dialog('非模態對話框,可以打開多個!',{modal:false}).show();
自動關閉
new Dialog('5秒后自動關閉',{time:5000}).show();
非fixed模式
new Dialog('對話框不隨滾動條移動',{fixed:false}).show();
顯示指定ID的內容
// 將顯示本標簽內的內容。
new Dialog({type:'id',value:'content-type-id'}).show();
加載一張圖片
new Dialog({type:'img',value:'http://www.caixw.com/public/uploads/demo/images/300x125.gif'}).show();
加載一URL地址
new Dialog({type:'url',value:'http://www.caixw.com/public/uploads/demo/jquery/dialog/test.html'}).show();
加載一URL到iframe
new Dialog({type:'iframe',value:'http://www.caixw.com'}).show();
自定義CSS
自定義背景遮蓋層
#dialog1-overlay
{
background:blue;
opacity:0.8;
filter:alpha(opacity=80);
}
new Dialog('自定義背景遮蓋層',{id:'dialog1'}).show();
自定義內容部分背景
#dialog2 .content
{
width:250px;
height:80px;
background-image:url(http://www.caixw.com/public/uploads/demo/images/300x125.gif);
}
new Dialog('自定義內容部分背景',{id:'dialog2'}).show();
回調函數
show()函數
new Dialog('show()回調函數'
{beforeShow:function(){alert('before show'),return true},afterShow:function(){alert('after show');}})
.show();
hide()函數
dlg = new Dialog('hide()回調函數'
{beforeHide:function(){alert('before hide'),return true},afterHide:function(){alert('after hide');}})
.show();
dlg.hide();
close()函數
new Dialog('close()回調函數'
{beforeClose:function(){alert('before close'),return true},afterClose:function(){alert('after close');}})
.show();