jQuery Mobile: change/switch theme on listview data-split-icon

南楼画角 提交于 2019-12-06 14:21:53

问题


I have split listview (with collapsible set) in jQuery Mobile (jQm). You can see it here on JSfiddle.

I want the split icon act as checkbox. The icon has default data-theme="c" so it is grey and I want to change the data-theme to b on click, so the icon color should change to blue.

I tried different solutions to change data-theme and found several more or less (more the less) working solution. The best is simple jQm code $(this).buttonMarkup({theme: 'b'});, but, changing data theme this way dont change color of icon, but only change color of its background, as you can try in mentioned JSfiddle.

Normaly data-theme on split listview, will only affect icon, but when it is changed this way, it affects icons background. I want to change only icon, not its background and I cannot find way to do that. Probably wrong selector or some kind of bug.

What do you think?


回答1:


Add the below to your code.

Demo

$(this).find('span.ui-btn').buttonMarkup({
   theme: 'b'
});

and

$(this).find('span.ui-btn').buttonMarkup({
   theme: 'c'
});

As span.ui-btn holds the icon and its' style.



来源:https://stackoverflow.com/questions/18485493/jquery-mobile-change-switch-theme-on-listview-data-split-icon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!