how to pop a dialog in mobile using mobile jquery with out click event -
i have tried of snippets how not work me may approach not correct.
it displays dialog wihout poping
here completed code. body please me out.
i tried code in jsbin.com editer.
<!doctype html> <html> <head> <link href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script> </head> <body> <div id="divid" data-rel="dialog" > dialog </div> </div> <script> (function(){ $.mobile.changepage( $('#divid'), { role: 'dialog', transition: 'pop'} ); })(); </script> </body> </html>
note: dialog widget deprecated in 1.4 , removed in 1.5. page widget has dialog option which, when set true apply dialog styling page.
as of jquery mobile, there no data-role=dialog
, instead, page can converted dialog add data-dialog="true"
attribute page div.
<div data-role="page" data-dialog="true" id="foo"> <div data-role="header" data-close-btn="right"> <h1>dialog</h1> </div> <!-- contents --> </div>
to call programmatically:
$.mobile.pagecontainer.pagecontainer("change", "#foo", { transition: "pop" });
Comments
Post a Comment