Any suggestions on a Jquery Modal box that is mobile friendly?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
There is a modal in JQM already. It's called Dialog, just like the JQ UI version.
Here is example code:
<!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