ITeye博客

jq ui.dialog.js简介

mfan · 2011-07-19 00:08 · jQuery · Web前端 · Markdown

  1. ·概述
  2. 一个浮动的窗口,包含标题和内容两部分。可以移动,调整大小,以及关闭图标 '×' 。
  3. 如果内容长度超过了对话框内容区域的显示,则会自动出现滚动条。
  4. 除此之外,还有一些常用的选项,如:添加底部按钮栏、模式窗口屏蔽层等。
  5. 官方示例地址:http: //jqueryui.com/demos/dialog/
  6. ·参数(名称 : 参数类型 : 默认值)
  7. autoOpen : Boolean :  true
  8. 如果设置为 true ,则默认页面加载完毕后,就自动弹出对话框;相反则处理hidden状态。
  9. 初始:$( '.selector' ).dialog({ autoOpen:  false  });
  10. 获取: var  autoOpen = $( '.selector' ).dialog( 'option' ,  'autoOpen' );
  11. 设置:$( '.selector' ).dialog( 'option' ,  'autoOpen' ,  false );
  12. bgiframe : Boolean :  false
  13. 如果设置为 true ,则调用bgiframe插件,用于修复在IE6浏览器中无法显示于其它控件(select,flash)之上的问题。
  14. 初始:$( '.selector' ).dialog({ bgiframe:  true  });
  15. 获取: var  bgiframe = $( '.selector' ).dialog( 'option' ,  'bgiframe' );
  16. 设置:$( '.selector' ).dialog( 'option' ,  'bgiframe' ,  true );
  17. buttons : Object : { }
  18. 为对话框添加相应的按钮及处理函数。
  19. 初始:$( '.selector' ).dialog({ buttons: {  "Ok" :  function () { $( this ).dialog( "close" ); } } });
  20. 获取: var  buttons = $( '.selector' ).dialog( 'option' ,  'buttons' );
  21. 设置:$( '.selector' ).dialog( 'option' ,  'buttons' , {  "Ok" :  function () { $( this ).dialog( "close" ); } });
  22. closeOnEscape : Boolean :  true
  23. 设置当对话框打开的时候,用户按ESC键是否关闭对话框。
  24. 初始:$( '.selector' ).dialog({ closeOnEscape:  false  });
  25. 获取: var  closeOnEscape = $( '.selector' ).dialog( 'option' ,  'closeOnEscape' );
  26. 设置:$( '.selector' ).dialog( 'option' ,  'closeOnEscape' ,  false );
  27. dialogClass : String :  ''
  28. 设置指定的类名称,它将显示于对话框的标题处。
  29. 初始:$( '.selector' ).dialog({ dialogClass:  'alert'  });
  30. 获取: var  dialogClass = $( '.selector' ).dialog( 'option' ,  'dialogClass' );
  31. 设置:$( '.selector' ).dialog( 'option' ,  'dialogClass' ,  'alert' );
  32. draggable : Boolean :  true
  33. 如果设置为 true ,则允许拖动对话框的标题栏移动窗口。
  34. 初始:$( '.selector' ).dialog({ draggable:  false  });
  35. 获取: var  draggable = $( '.selector' ).dialog( 'option' ,  'draggable' );
  36. 设置:$( '.selector' ).dialog( 'option' ,  'draggable' ,  false );
  37. height : Number :  'auto'
  38. 设置对话框的高度(单位:像素)。
  39. 初始:$( '.selector' ).dialog({ height: 530 });
  40. 获取: var  height = $( '.selector' ).dialog( 'option' ,  'height' );
  41. 设置:$( '.selector' ).dialog( 'option' ,  'height' , 530);
  42. hide : String :  null
  43. 使对话框关闭(隐藏),可添加动画效果。
  44. 初始:$( '.selector' ).dialog({ hide:  'slide'  });
  45. 获取: var  hide = $( '.selector' ).dialog( 'option' ,  'hide' );
  46. 设置:$( '.selector' ).dialog( 'option' ,  'hide' ,  'slide' );
  47. maxHeight : Number :  false
  48. 设置对话框的最大高度(单位:像素)。
  49. 初始:$( '.selector' ).dialog({ maxHeight: 400 });
  50. 获取: var  maxHeight = $( '.selector' ).dialog( 'option' ,  'maxHeight' );
  51. 设置:$( '.selector' ).dialog( 'option' ,  'maxHeight' , 400);
  52. maxWidth : Number :  false
  53. 设置对话框的最大宽度(单位:像素)。
  54. 初始:$( '.selector' ).dialog({ maxWidth: 600 });
  55. 获取: var  maxWidth = $( '.selector' ).dialog( 'option' ,  'maxWidth' );
  56. 设置:$( '.selector' ).dialog( 'option' ,  'maxWidth' , 600);
  57. minHeight : Number : 150
  58. 设置对话框的最小高度(单位:像素)。
  59. 初始:$( '.selector' ).dialog({ minHeight: 300 });
  60. 获取: var  minHeight = $( '.selector' ).dialog( 'option' ,  'minHeight' );
  61. 设置:$( '.selector' ).dialog( 'option' ,  'minHeight' , 300);
  62. minWidth : Number : 150
  63. 设置对话框的最小宽度(单位:像素)。
  64. 初始:$( '.selector' ).dialog({ minWidth: 400 });
  65. 获取: var  minWidth = $( '.selector' ).dialog( 'option' ,  'minWidth' );
  66. 设置:$( '.selector' ).dialog( 'option' ,  'minWidth' , 400);
  67. modal : Boolean :  false
  68. 是否为模式窗口。如果设置为 true ,则在页面所有元素之前有个屏蔽层。
  69. 初始:$( '.selector' ).dialog({ modal:  true  });
  70. 获取: var  modal = $( '.selector' ).dialog( 'option' ,  'modal' );
  71. 设置:$( '.selector' ).dialog( 'option' ,  'modal' ,  true );
  72. position : String, Array :  'center'
  73. 设置对话框的初始显示位置。可选值:  'center' ,  'left' ,  'right' ,  'top' ,  'bottom' , 或是一个数组[ 'right' , 'top' ]
  74. 初始:$( '.selector' ).dialog({ position:  'top'  });
  75. 获取: var  position = $( '.selector' ).dialog( 'option' ,  'position' );
  76. 设置:$( '.selector' ).dialog( 'option' ,  'position' ,  'top' );
  77. resizable : Boolean :  true
  78. 设置对话框是否可以调整大小。
  79. 初始:$( '.selector' ).dialog({ resizable:  false  });
  80. 获取: var  resizable = $( '.selector' ).dialog( 'option' ,  'resizable' );
  81. 设置:$( '.selector' ).dialog( 'option' ,  'resizable' ,  false );
  82. show : String :  null
  83. 用于显示对话框。
  84. 初始:$( '.selector' ).dialog({ show:  'slide'  });
  85. 获取: var  show = $( '.selector' ).dialog( 'option' ,  'show' );
  86. 设置:$( '.selector' ).dialog( 'option' ,  'show' ,  'slide' );
  87. stack : Boolean :  true
  88. 设置移动时对话框是否前置于其它的对话框前面。
  89. 初始:$( '.selector' ).dialog({ stack:  false  });
  90. 获取: var  stack = $( '.selector' ).dialog( 'option' ,  'stack' );
  91. 设置:$( '.selector' ).dialog( 'option' ,  'stack' ,  false );
  92. title : String :  ''
  93. 指定对话框的标题,也可以在对话框附加元素的title属性中设置标题。
  94. 初始:$( '.selector' ).dialog({ title:  'Dialog Title'  });
  95. 获取: var  title = $( '.selector' ).dialog( 'option' ,  'title' );
  96. 设置:$( '.selector' ).dialog( 'option' ,  'title' ,  'Dialog Title' );
  97. width : Number : 300
  98. 设置对话框的宽度(单位:像素)。
  99. $( '.selector' ).dialog({ width: 460 });
  100. 获取: var  width = $( '.selector' ).dialog( 'option' ,  'width' );
  101. 设置:$( '.selector' ).dialog( 'option' ,  'width' , 460);
  102. zIndex : Integer : 1000
  103. 设置对话框的zindex值。
  104. 初始:$( '.selector' ).dialog({ zIndex: 3999 });
  105. 获取: var  zIndex = $( '.selector' ).dialog( 'option' ,  'zIndex' );
  106. 设置:$( '.selector' ).dialog( 'option' ,  'zIndex' , 3999);
  107. ·事件
  108. beforeclose : dialogbeforeclose
  109. 当对话框关闭之前,触发此事件。如果返回 false ,则对话框仍然显示。
  110. 初始:$( '.selector' ).dialog({ beforeclose:  function (event, ui) { ... } });
  111. 绑定:$( '.selector' ).bind( 'dialogbeforeclose' ,  function (event, ui) { ... });
  112. open : dialogopen
  113. 当对话框打开后,触发此事件。
  114. 初始:$( '.selector' ).dialog({ open:  function (event, ui) { ... } });
  115. 绑定:$( '.selector' ).bind( 'dialogopen' ,  function (event, ui) { ... });
  116. focus : dialogfocus
  117. 当对话框获取焦点时,触发此事件。
  118. 初始:$( '.selector' ).dialog({ focus:  function (event, ui) { ... } });
  119. 绑定:$( '.selector' ).bind( 'dialogfocus' ,  function (event, ui) { ... });
  120. dragStart : dragStart
  121. 当开始拖拽对话框移动时,触发此事件。
  122. 初始:$( '.selector' ).dialog({ dragStart:  function (event, ui) { ... } });
  123. 绑定:$( '.selector' ).bind( 'dragStart' ,  function (event, ui) { ... });
  124. drag : drag
  125. 当拖拽对话框移动时,触发此事件。
  126. 初始:$( '.selector' ).dialog({ drag:  function (event, ui) { ... } });
  127. 绑定:$( '.selector' ).bind( 'drag' ,  function (event, ui) { ... });
  128. dragStop : dragStop
  129. 当拖拽对话框动作结束时,触发此事件。
  130. 初始:$( '.selector' ).dialog({ dragStop:  function (event, ui) { ... } });
  131. 绑定:$( '.selector' ).bind( 'dragStop' ,  function (event, ui) { ... });
  132. resizeStart : resizeStart
  133. 当开始改变对话框大小时,触发此事件。
  134. 初始:$( '.selector' ).dialog({ resizeStart:  function (event, ui) { ... } });
  135. 绑定:$( '.selector' ).bind( 'resizeStart' ,  function (event, ui) { ... });
  136. resize : resize
  137. 当对话框大小改变时,触发此事件。
  138. 初始:$( '.selector' ).dialog({ resize:  function (event, ui) { ... } });
  139. 绑定:$( '.selector' ).bind( 'resize' ,  function (event, ui) { ... });
  140. resizeStop : resizeStop
  141. 当对话框大小改变结束时,触发此事件。
  142. 初始:$( '.selector' ).dialog({ resizeStop:  function (event, ui) { ... } });
  143. 绑定:$( '.selector' ).bind( 'resizeStop' ,  function (event, ui) { ... });
  144. close : dialogclose
  145. 当对话框关闭后,触发此事件。
  146. 初始:$( '.selector' ).dialog({ close:  function (event, ui) { ... } });
  147. 绑定:$( '.selector' ).bind( 'dialogclose' ,  function (event, ui) { ... });
  148. ·属性
  149. destroy
  150. 销毁对话框对象。
  151. 用法:.dialog(  'destroy'  )
  152. disable
  153. 禁用对话框。
  154. 用法:.dialog(  'disable'  )
  155. enable
  156. 启用对话框。
  157. 用法:.dialog(  'enable'  )
  158. option
  159. 获取或设置对话框的属性。
  160. 用法:.dialog(  'option'  , optionName , [value] )
  161. close
  162. 关闭对话框。
  163. 用法:.dialog(  'close'  )
  164. isOpen
  165. 用于判断对话框是否处理打开状态。
  166. 用法:.dialog(  'isOpen'  )
  167. moveToTop
  168. 将对话框移至最顶层显示。
  169. 用法:.dialog(  'moveToTop'  )
  170. open
  171. 打开对话框。
  172. 用法:.dialog(  'open'  )

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。