如何阻止JQM设置页面样式?

spe*_*peg 12 jquery-mobile

我有一个JQM应用程序,其中有一个我不想要样式化的特定页面.

到目前为止我所找到的只是data-role='none'- 但我不想将其应用于页面上的每个元素......如果只为这一页关闭,有没有办法关闭?

Jas*_*per 15

您可以data-enhance="false"结合使用$.mobile.ignoreContentEnabled=true来停止jQuery Mobile对伪页面执行的自动增强:

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script>
$(document).on('mobileinit', function () {
    $.mobile.ignoreContentEnabled = true;
});
</script>
<script src="http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.js"></script>

<div data-enhance="false" data-role="page">
    ...
</div>?
Run Code Online (Sandbox Code Playgroud)

您必须更改ignoreContentEnabled标志的原因是因为搜索父元素的CPU密集data-attribute,因此默认情况下这是关闭的.

这是一个演示:http://jsfiddle.net/ZtJyL/1/