【发布时间】:2013-05-14 21:30:22
【问题描述】:
我如何使用 jQuery + jQuery Mobile。有一个弹出对话框在一段时间后消失。 这个我在某种程度上写的作品。它会在一段时间后消失。但是,当我单击按钮再次激活它时,它不起作用,除非我再次刷新页面。
JavaScript
<script type="text/javascript">
$(document).on('pageinit', function(e) {
$('#postnote').click(function() {
$('#dialog').popup('open', {history: false}).delay(500).fadeOut('slow').hide();
});
});
</script>
页面
<div data-role="page" id="addnote">
<div id="dialog" data-role="popup" data-transition="fade">
<div data-role="header"><h1>Note posted</h1></div>
</div>
<div data-role="header" data-theme="a">
<h1>Add Note</h1>
</div>
<div data-role="content" data-theme="b">
<textarea id="note" rows="40" name="note"></textarea>
<a href="#" id="postnote" data-role="button" data-transition="fade" data-theme="b">Post</a>
<a href="#" data-rel="back" data-role="button" data-transition="slidefade" data-theme="a" data-direction="reverse">Back</a>
</div><!-- /content -->
</div><!-- /page -->
【问题讨论】:
标签: jquery jquery-mobile setinterval jquery-mobile-popup