jquery - How to have the popup dialog disappear after some time? -
how can jquery + jquery mobile. have popup dialog disappear after time. 1 written work extent. disappear after sometime. when click button activate again doesn't work, unless refresh page again.
javascript
<script type="text/javascript"> $(document).on('pageinit', function(e) { $('#postnote').click(function() { $('#dialog').popup('open', {history: false}).delay(500).fadeout('slow').hide(); }); }); </script>
the page
<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 -->
you can way.
$(document).on('popupafteropen', '.ui-popup', function() { settimeout(function () { $(this).popup('close'); }, 5000); });
Comments
Post a Comment