如何阻止JQM设置页面样式? [英] How to stop JQM from styling a page?

查看:77
本文介绍了如何阻止JQM设置页面样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JQM应用,其中有一个我不想设置样式的特定页面.

I have a JQM app with one specific page that I do not want styled.

到目前为止,我发现的只是data-role='none'-但我不想将其应用于页面上的每个元素...是否可以仅关闭此页面? >

All I have found so far is data-role='none' - but I don't want to have to apply that to every element on the page... Is there a way to turn if off just for this one page?

推荐答案

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

You can use data-enhance="false" in conjunction with $.mobile.ignoreContentEnabled=true to stop the auto-enhancement that jQuery Mobile does to a pseudo-page:

<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>​

您必须更改ignoreContentEnabled标志的原因是因为在data-attribute的父元素中搜索会占用大量CPU资源,因此默认情况下将其关闭.

The reason you have to change the ignoreContentEnabled flag is because it's CPU intensive to search parent elements for the data-attribute, so this is turned-off by default.

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

这篇关于如何阻止JQM设置页面样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆