jQuery Mobile默认数据主题 [英] JQuery Mobile default data-theme
问题描述
有人知道如何为jquery-mobile设置默认数据主题吗?
Does anyone know how to set a default data-theme for jquery-mobile?
似乎有必要为每个组件设置数据主题.
It looks like it´s necessary to set the data-theme for every component.
即使为页面数据角色设置了数据主题,加载的列表和其他组件也不会遵守该主题.
Even when you set the data-theme for the page data-role it is not respected by loaded lists and other components.
我是否缺少手册的某些页面?
Am I missing some page of the manual?
推荐答案
就像乔尔所说,您必须覆盖默认值.目前看来,没有其他办法了.
Like Joel said, you have to overwrite the default values. At the moment it seems like there is no other way.
使用Joel的示例代码:
Take Joel's sample code:
<script src="jquery.js"></script>
<script src="custom-scripting.js"></script>
<script src="jquery-mobile.js"></script>
自定义您的custom-scripting.js
Customize your custom-scripting.js
这是一个示例代码,您可以配置更多选项:
This is a sample code with a few more options you can configure:
$(document).bind("mobileinit", function () {
// Navigation
$.mobile.page.prototype.options.backBtnText = "Go back";
$.mobile.page.prototype.options.addBackBtn = true;
$.mobile.page.prototype.options.backBtnTheme = "d";
// Page
$.mobile.page.prototype.options.headerTheme = "a"; // Page header only
$.mobile.page.prototype.options.contentTheme = "c";
$.mobile.page.prototype.options.footerTheme = "a";
// Listviews
$.mobile.listview.prototype.options.headerTheme = "a"; // Header for nested lists
$.mobile.listview.prototype.options.theme = "c"; // List items / content
$.mobile.listview.prototype.options.dividerTheme = "d"; // List divider
$.mobile.listview.prototype.options.splitTheme = "c";
$.mobile.listview.prototype.options.countTheme = "c";
$.mobile.listview.prototype.options.filterTheme = "c";
$.mobile.listview.prototype.options.filterPlaceholder = "Filter data...";
});
还应该有其他选项,例如:
There should be also other options like:
$.mobile.dialog.prototype.options.theme
$.mobile.selectmenu.prototype.options.menuPageTheme
$.mobile.selectmenu.prototype.options.overlayTheme
您也许可以在这里找到更多设置: http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0 b2.js
You might be able to find more settings here: http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.js
这篇关于jQuery Mobile默认数据主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!