jQuery Mobile:单击更改主题 [英] Jquery mobile: Change theme on click

查看:66
本文介绍了jQuery Mobile:单击更改主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个主题为a的基本列表.我试图找到一种单击按钮时更改主题的方法.尝试将$('a li').attr('data-theme','a');与列表刷新结合起来没有任何运气.那里成功了吗?

I have got a basic list with the theme a. I am trying to find a way to change the theme when clicking on a button. Have tried $('a li').attr('data-theme','a'); combined with list refresh with no luck. An success out there?

推荐答案

您必须在页面上搜索所有ui-body-,ui-button-up,ui-button-down,ui-button-hover和ui-bar-类,在每个类的末尾找到字母,删除这些类,然后在每个类的末尾将它们添加回所需的主题字母.目前,我正在开发一个插件.

You would have to search the page for all ui-body-, ui-button-up, ui-button-down, ui-button-hover, and ui-bar- classes, find the letter at the end of each of those, remove those classes then add them back with the desired theme letter at the end of each class. I am working on a plugin to do just that at the moment.

下面将把设置为主题D的栏的页面更改为主题B:

The below would change a page set to theme D's bars to theme B:

var pages = $("div[data-role='page']"), pageThemeClasses = $(pages+"[class$=d]");

$(pageThemeClasses).removeClass('ui-bar-b');
$(pageThemeClasses).addClass('ui-bar-b');

这篇关于jQuery Mobile:单击更改主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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