jQuery Mobile: Dialog box

This entry is part 10 of 73 in the series jQuery Mobile

Instead of going to a page, we can also open pagetwo as a dialog box.

To do that, we add data-dialog=’true’.

<div data-role='page' data-dialog='true' id='pagetwo'>

The only change is in putting data-dialog=’true’ in pagetwo div.

Dialog Box
<!DOCTYPE html>
<html>
<head>
    <link href='http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css' rel='stylesheet'/>
    <script src='http://code.jquery.com/jquery-1.10.2.min.js'></script>
    <script src='http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js'></script>
    <title>Upwhere</title>
</head>
<body>
<div data-role='page' id='pageone'>
    <div data-role='header'><h1>My Mobile App</h1></div>
    <div data-role='content'>
        <p>Your page one content here</p>
      <a href='#pagetwo' data-role='button'>Click Me</a>
    </div>
    <div data-role="footer" data-position="fixed">
	<h1>Fixed Footer!</h1>
</div>
</div>
<div data-role='page' data-dialog='true' id='pagetwo'>
    <div data-role='header'><h1>My Mobile App</h1></div>
    <div data-role='content'>
        <p>You are at page two!</p>
        <a href='#pageone' data-role='button'>Go Back</a>
    </div>
</div>

</body>
</html>
Try The Code
Series Navigation<< jQuery Mobile: Fixed footer
jQuery Mobile: Transitions >>

Leave a comment

Leave a Reply