49

是否可以指示 jQuery Mobile 不设置我的输入框和提交按钮的样式。我对我的自定义 CSS 很满意。jQuery 移动脚本正在将自己的样式应用于我的所有元素。

我尝试的一种解决方法是在我的自定义 CSS 中覆盖这些元素。有没有其他可用的功能我可以做到这一点?像这样的东西

$.ignoreStyles("button,text");
4

4 回答 4

102

jQuery Mobile 将忽略data-role属性设置为none. 因此,您可以简单地将这些属性添加到您的标记中:

<input type="text" name="foo" data-role="none" />
<button type="button" id="bar" data-role="none">Button</button>
于 2012-04-11T15:28:03.677 回答
7

这对我有用。

$(document).bind("mobileinit", function() {
  $.mobile.ignoreContentEnabled = true;
});

<div data-enhance="false">
    <input type="checkbox" name="chkbox1" id="chkbox1" 
      checked />
    <label for="chkbox1">Checkbox</label>
    <input type="radio" name="radiobtn1" id="radiobtn1" 
      checked />
    <label for="radiobtn1">Radio Button</label>
  </div>
于 2013-03-27T16:50:08.390 回答
2

@angelokh 解决方案对我有用。另请查看以下链接:

http://my.safaribooksonline.com/book/-/9781849517225/7dot-configurations/ch07s06_html

此外,关键是在包含 jquery.mobile.js 之前添加以下脚本:

$(document).bind("mobileinit", function() {
  $.mobile.ignoreContentEnabled = true;
});
于 2013-06-08T00:21:57.450 回答
-1

试试这个

$(document).on('pagebeforecreate', function( e ) {
    $.mobile.ignoreContentEnabled=true;
});
于 2016-08-31T09:24:43.840 回答