我正在使用 jquerymobile 构建适用于 iOS 的 PhoneGap 应用程序,我尝试更改 jquerymobile 的背景,但我不能。 这是我的 html 源代码:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.1/jquery.mobile-1.2.1.min.css" />
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.1/jquery.mobile-1.2.1.min.js"></script>
<script type="text/javascript" src="../../js/cordova-2.5.0.js"></script>
<link rel="stylesheet" href="mainUI.css"/>
</head>
<body>
<div data-role="page" id='mypage'>
<div data-role="header" data-position="fixed">
<h1>Page Title</h1>
<a data-role="button" data-rel="back">back</a>
</div><!-- /header -->
<div data-role="content">
content
</div><!-- /content -->
<div class="my-footer" style="background-color: #00FF00;" data-role="footer" data-position="fixed">
<div class="my-tabbar">
MYTEST div
</div>
</div>
</div><!-- /page -->
</body>
</html>
这是我的自定义 CSS 文件:
.my-footer {
background-color: #ff0000;
}
.my-footer .my-tabbar{
background-color: #ff0000;
}
.my-tabbar{
background-color: #ff00ff;
}
当我在 Chrome 浏览器上运行这个 html 时,我成功了。但是当我在iPhone5设备上运行时,却没有。 请帮忙。
最佳答案
您需要使用实际的 jQuery 页脚移动选择器。您可以在 iPhone 上使用 Safari Web 检查器来查找任何内容的精确选择器,并在您自己的样式表中进行相应的更改。
以下是一些我认为可以完成这项工作的选择器:
.ui-bar-a.ui-footer {
/*Change background here */
}
P.S 在您的样式表中,如果您想覆盖 jQuery mobile,请使您的选择器更加具体。 所以而不是...
.ui-bar-a.ui-footer {
/*Change background here */
}
使用...
.my-footer.ui-bar-a.ui-footer {
/*Change background here */
}
或者......
.home-page .ui-bar-a.ui-footer {
/*Change background here */
}
关于jquery - 如何改变jquery mobile页脚的背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15737599/