Jquery mobile 更新按类名选择的主题
以下内容适用于所有按钮和选项(jqm 1.2)。页面主题是data-theme-a。如何使其在类名为cc_group的页面上的特定选择中工作Jquery mobile 更新按类名选择的主题,jquery-mobile,Jquery Mobile,以下内容适用于所有按钮和选项(jqm 1.2)。页面主题是data-theme-a。如何使其在类名为cc_group的页面上的特定选择中工作 $(document).on('click', '.btn_setup', function (event, ui) { var theme = 'e'; //the only difference between this block of code and the same code above is t
$(document).on('click', '.btn_setup', function (event, ui) {
var theme = 'e';
//the only difference between this block of code and the same code above is that it doesn't target list-dividers by calling: `.not('.ui-li-divider')`
$.mobile.activePage.find('.ui-btn').not('.ui-li-divider')
.removeClass('ui-btn-a')
.addClass('ui-btn-up-' + theme)
.attr('data-theme', theme);
});
这管用!对于那些寻找答案的人来说,关键是包含select(classnameuselect)的div。然后ui btn up是已设置样式的jqm按钮
$(".cc_group").closest("div").addClass('ui-btn-up-' + theme).attr("data-theme", "e").removeClass("ui-btn-hover-a").removeClass("ui-btn-up-a");