mobilebone
Version:
Bone main for mobile web APP with a sigle page mode by using HTML5 history API router.
41 lines (38 loc) • 1.67 kB
HTML
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<title>Mobilebone.js API文档-data-ajax</title>
<link rel="stylesheet" href="../../src/mobilebone.css">
<link rel="stylesheet" href="../assets/docs.css">
</head>
<body>
<header id="header"></header>
<aside id="aside"></aside>
<div class="page out">
<div class="content">
<h2>data-ajax</h2>
<p>主要用在<code>a</code>元素和<code>form</code>元素上,表示是否对应内容启用Ajax请求,而不是直接跳转或提交。</p>
<p>支持两个值,<code>true</code>和<code>false</code>.</p>
<ol>
<li><strong>data-ajax="true"</strong>
<p>Mobilebone会自动判断链接是否跨域,如果跨域,会自动链接处理。然而,有时候,虽跨域,我们还是希望使用Ajax, XMLHttpRequest 2.0支持子域跨域请求,遇到这种情况,就可以设置<code>data-ajax="true"</code>.</p>
<p>或者全局<code>Mobilebone.captureLink = false</code>, 也会需要此自定义属性。</p>
</li>
<li><strong>data-ajax="true"</strong>
<p>这个很好理解了,链接还是那个链接,不是无刷新加载模式。</p>
<p>如果希望通篇都跳转,可设置<code>Mobilebone.captureLink = false</code>.</p>
</li>
</ol>
</div>
</div>
<script src="../../src/mobilebone.js"></script>
<script>
Mobilebone.captureLink = false;
window.navKey = "data-ajax";
</script>
<script src="nav.js"></script>
<script src="../assets/docs.js"></script>
</body>
</html>