jQuery mobile dialog 详情
2016-11-24 16:35
288 查看
//连接的方式打开对话框 这个比较简单 <a href="dialog.html" class="ui-btn mybtn" data-transition="pop">连接打开对话框</a> //js的方式打开对话框 这个也不是很复杂 <a href="#" class="ui-btn mybtn opendialogByjs" data-transition="pop">JS打开对话</a> //绑定函数 页面 pageshow的时候
$( "#dialogPage" ).on( "pagecreate", function( event ) { }).on("pageshow",function(){ var page = $(this); //这里一定要记得unbind("click") 要不然一个页面可能会绑定多次 page.find(".opendialogByjs").unbind("click").on("click",function(){ //加一个隐藏的a标签 a标签的href指向dialog.html $('#dialogPage').append("<a id='tPushDialog' href='dialog.html' data-rel=\"dialog\" style='display:none;'>Open dialog</a> "); // 触发a标签的click事件 $("#tPushDialog").trigger('click'); }); });
dialog.html--->
<div data-role="page" data-dialog="true" id="dialogpage"> <div data-role="header" data-theme="b"> <h1>Dialog</h1> </div> <div role="main" class="ui-content"> <h1>标题</h1> <p>弹出页内容<code>data-rel="dialog"</code> attribute.</p> <a href="index.html" data-rel="back" class="ui-btn ui-shadow ui-corner-all ui-btn-a">确定</a> <a href="index.html" data-rel="back" class="ui-btn ui-shadow ui-corner-all ui-btn-a">取消</a> </div> </div> //对话框可以动态关闭的 这是官方提供的方法 其实看源码就知道它的功能只是退回 也就是返回上一页 $("#dialogpage").dialog("close"); //dialog的声明周期与其他页面的生命周期一样pagebeforeload-pagebeforecreate-pagecreate-pageinit等 不再列举
相关文章推荐
- Jquery Mobile dialog的生命周期
- Jquery Mobile dialog的生命周期
- Jquery Mobile dialog的生命周期 - 落叶潇潇雨 - 博客园
- [转]Jquery Mobile dialog的生命周期
- Jquery Mobile dialog的生命周期
- Jquery Mobile dialog的生命周期
- Jquery UI Dialog 之 Form 表单提交
- [转]jQuery UI Dialog控件中的表单无法正常提交的解决方法
- jquery dialog 获取焦点
- Jquery Mobile + PhoneGap
- JQueryMobile listview动态刷新
- jQuery实现的Dialog(支持模态和拖动)
- jquery-mobile 学习笔记之二(表单创建)
- Jquery UI dialog 详解 (中文)
- HTML5与JQuery.Mobile(五)
- Jquery mobile div常用属性
- jQuery UI Dialog使用
- jQuery UI vs Kendo UI & jQuery Mobile vs Kendo UI Mobile
- jquery-mobile 学习笔记之一(基础属性)
- [原]JQuery mobile CSS 文件组织