bod*_*ous 4 jquery jquery-mobile
我知道我可以创建一个jQuery移动覆盖,从其他页面加载内容.
我可以手动创建叠加层以向用户显示消息吗?比标准的JS警报盒更性感?
更新
而不是说
<a href="my_message.html" data-rel="dialog">Show Message</a>
Run Code Online (Sandbox Code Playgroud)
我想说的是:
$.showDialog("Hello world!");
Run Code Online (Sandbox Code Playgroud)
指出正确的方向:
有关:
实例:
JS:
var originalMessage = $('#the-content').html();
var dynamicMessage = '<span>This is a dynamic message</span>'; // add dynamic content here
$('#dynamic').click(function() {
$('#generic-dialog').live('pagebeforeshow',function(event, ui) {
$('#the-content').html(dynamicMessage).trigger('create');
});
});
$('#original').click(function() {
$('#generic-dialog').live('pagebeforeshow',function(event, ui) {
$('#the-content').html(originalMessage).trigger('create');
});
});
Run Code Online (Sandbox Code Playgroud)
HTML:
<div data-role="page" id="home">
<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="f" id="tasks">
<li data-role="list-divider">Dynamic Dialog</li>
<li><a href="#generic-dialog" data-rel="dialog" id="original">Show Original Dialog</a></li>
<li><a href="#generic-dialog" data-rel="dialog" id="dynamic">Show Dynamic Dialog</a></li>
</ul>
</div>
</div>
<!-- This is a page used for a dialog -->
<div data-role="page" id="generic-dialog">
<div data-role="header" data-theme="d">
<h1>Dialog</h1>
</div>
<div data-role="content" data-theme="c" id="the-content">
<h1>Delete page?</h1>
<p>This is a regular page, styled as a dialog. To create a dialog, just link to a normal page and include a transition and <code>data-rel="dialog"</code> attribute.</p>
<a href="#" data-role="button" data-rel="back" data-theme="b">Sounds good</a>
<a href="#" data-role="button" data-rel="back" data-theme="c">Cancel</a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13453 次 |
| 最近记录: |