移动友好Jquery模态盒?

时间:2011-08-24 18:05:02

标签: jquery mobile modal-dialog

有关Jquery模式框的任何建议是否适合移动设备?

1 个答案:

答案 0 :(得分:4)

JQM中已有一种模式。它叫做Dialog,就像JQ UI版本一样。

以下是示例代码:

<!DOCTYPE html> 
<html> 
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>Single page template</title> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
    <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
</head> 
<body> 

<div data-role="page" id="main">

    <div data-role="header">
        <h1>Single page</h1>
    </div><!-- /header -->

    <div data-role="content">   

        <a href="#modal" data-rel="dialog">Open dialog</a> 
     </div><!-- /content -->

    <div data-role="footer">
        <h4>Footer content</h4>
    </div><!-- /footer -->
</div><!-- /page -->

<!-- modal -->
<div data-role="page" id="modal">

    <div data-role="header" data-theme="e">
        <h1>Dialog (modal)</h1>

    </div><!-- /header -->

    <div data-role="content" data-theme="d">    
        <h2>Modal</h2>
        <p>Content of Modal Goes Here</p>       

    </div><!-- /content -->


    <div data-role="footer">
        <h4>Page Footer</h4>
    </div><!-- /footer -->
</div><!-- /page modal -->

</body>
</html>

JQM Dialog docs:http://jquerymobile.com/demos/1.0/docs/pages/page-dialogs.html