dialog()

投稿日:2022-10-10 投稿者:PS カテゴリ:その他 タグ: , , ,

ダイアログボックスを表示する jQuery-UI[efn_note]dialog() – jQuery UI[/efn_note] ウイジェット。

obj.dialog({
  "position":{"my":"center", "at":"center", "of":window},
  "modal":true,
  "buttons":[
    {
      "text":"保存",
      "click":function(){  }
    },
    {
      "text":"キャンセル",
      "click":function(){ $(this).dialog("close"); }
    }
  ]
);
オプション名初期値備考
autoOpentrue定義時に開くかどうか
buttons[]ボタン定義
closeOnEscapetrueESC でダイアログを閉じるかどうか
draggabletrueタイトルバーをドラッグしてダイアログ全体を移動させるかどうか
heightauto高さ
hidenull閉じる時のエフェクト定義
maxHeightfalse最大高さの指定
maxWidthfalse最大幅の指定
minHeight150最小高さの指定
minWidth150最小幅の指定
modalfalse開いたときモーダル(ダイアログ外の作業をロックする)にするか
position{
my: “center”,
at: “center”,
of: window
}
開く位置
my:”center” … ダイアログの中央を
of:window … 画面の
at:”center” … 中央
に合わせる
resizabletrueダイアログサイズを変えられるようにするか
shownull開くときのエフェクト定義
titleタイトル。title 属性がある場合、それが表示される。

Tips

スタイルの変更

.ui-widget-overlay {
  background: #AAA;  /* 背景色の初期値 */
  opacity: .3;       /* 透明度 */
}