1. jquery.ui.dialog
官方地址
http://jqueryui.net/dialog/
jquery.ui.dialog是一个非常灵活的模式框,它的官方地址为: http://docs.jquery.com/UI/Dialog?
API???
?
2. 文件引用?
要使用jquery.ui.dialog,需要引用两个文件,1个是js,另外1个是css?
在contentpage中添加?
<script type="text/javascript" src="/Content/ui.js"></script>?
在masterpage中添加?
<link href="jquery-ui.css" rel="stylesheet" type="text/css">?
3. 使用方法?
jquery.ui.dialog相比thinkbox要有优势,thinkbox是在$.ready中指定的,导致不能灵活的扩展弹出层的弹出时机,针对一个逻辑判断,一种情况下弹出,另外一种不弹出,thinkbox就缺乏应变能力,而jquery.ui.dialog()采用 $('..').dialog(..);的方式使得弹出更加灵活?
1)弹出简单的对话框?
$("#dialog").dialog();?
2)弹出模式对话框?
$("#dialog").dialog({ modal: true });?
3)弹出模式对话框,并有遮罩效果?
$("#dialog").dialog({ modal: true, overlay: { opacity: 0.5, background: "black" } });?
4)带确定与取消按钮?
$("#dialog").dialog({ buttons: { "Ok": function() { alert("Ok"); }, "Cancel": function() { $(this).dialog("close"); } } });?
5)如何关闭对话框?
$("#dialog").dialog("close");
?
?
<!DOCTYPE html> <html> <head> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <script> $(document).ready(function() { $("#dialog").dialog(); }); </script> </head> <body style="font-size:62.5%;"> <div id="dialog" title="Dialog Title">I'm in a dialog</div> </body> </html>?
?
?
2. jQuery boxy
?
使用该jQuery插件
要想使用该jQuery插件,需要把$(selector).boxy();放在document.ready中。使用合适的选择器表达式替换这里的"selector",例如:"a[rel=boxy],form.with-confirmation"。这会给匹配的元素附加一些行为,如下:
- 一个href属性中如果锚点包含#,则此锚点相对应的ID的DOM元素的内容就会被添加到boxy对话框中。
- 如果href锚点内容为其他一些东西,则会试图使用Ajax载入其对应的内容。理想情况下,我们有相同的起源检查和委托对框架的跨域请求。这将会在下面展示。
- 表单上会显示一个提交模式的确认消息。
?
2使用方法
使用下载包中的三个文件!
<script type ="text/javascript " src ="../js/jquery.boxy.js "> </script>
?
<link rel ="stylesheet " href ="../css/boxy.css " type ="text/css " />
基本的插件用法
请注意,boxy对话框自动计算出您的内容区域内本身的大小和位置,没有必要明确规定了包装集的尺寸。
?
<link rel ="stylesheet " href ="../css/common.css " type ="text/css " /> |
?
?
?
具体内容见http://www.zhangxinxu.com/study/200911/jQuery-plugin-boxy.html ??? 官方网站见http://onehackoranother.com/projects/jquery/boxy/
?