欢迎加入QQ群技术交流:466355109,技术不全没关系,只要有交流的心就尽管来吧!!!
jQuery UI Dialog常用的参数有:
- autoOpen:默认true,即dialog方法创建就显示对话框
- buttons:默认无,用于设置显示的按钮,可以是JSON和Array形式:
- {"确定":function(){},"取消":function(){}}
- [{text:"确定", click: function(){}},{text:"取消",click:function(){}}]
- modal:默认false,是否模态对话框,如果设置为true则会创建一个遮罩层把页面其他元素遮住
- title:标题
- draggable:是否可手动,默认true
- resizable:是否可调整大小,默认true
- width:宽度,默认300
- height:高度,默认"auto"
其他一些不太常用的参数:
- closeOnEscape:默认true,按esc键关闭对话框
- show:打开对话框的动画效果
- hide:关闭对话框的动画效果
- position:对话框显示的位置,默认"center",可以设置成字符串或数组:
- 'center', 'left', 'right', 'top', 'bottom' 如果要组合,一定要按顺序写,比如要右下角,要写:['right','bottom']
- ['right','top'],通过上面的几个字符串组合(x,y)
- [350,100],绝对的数值(x,y)
- minWidth:默认150,最小宽度
- minHeight:默认150,最小高度
- <script language="javascript">
- $(document).ready(function() {
- //$("#dialog").dialog({ modal: true },{title:"ssss"});
- //$("#dialog").dialog({ show: { effect: 'drop', direction: "up" } });
- $("#dialog").dialog(
- {modal:true},
- {title:"登录提示"},
- {show:{effect:'drop', direction:'up'}},
- {hide:{effect:'drop', direction:'down'}},
- {position:['right','bottom']},
- {draggable:false},
- {resizable:false}
- );
- });
- </script>
- $(document).ready(function() {
- //$("#dialog").dialog({ modal: true },{title:"ssss"});
- //$("#dialog").dialog({ show: { effect: 'drop', direction: "up" } });
- $("#dialog").dialog({
- modal:true,
- title:"登录提示",
- show:{effect:'drop', direction:'up'},
- hide:{effect:'drop', direction:'down'},
- position:['right','bottom'],
- draggable:false,
- resizable:false
- });
- $("#dialog").css({color:"red","font-size":"12px"});
- });
- </script>