different colors on radio buttons when they are active in Jquery mobile

前端 未结 2 695
盖世英雄少女心
盖世英雄少女心 2021-01-28 04:26

I have three radio buttons which have the same theme in jquery. If I select one of them, the color of the button will change to the color specified in my .ui-btn-active class in

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-28 04:52

    Following styles should do the trick: Screenshot1 Vertically stacked

    .ui-radio:nth-child(1) .ui-icon-radio-on.ui-icon{
        background-color:green;
    }
    .ui-radio:nth-child(2) .ui-icon-radio-on.ui-icon{
        background-color:grey;
    }
    .ui-radio:nth-child(3) .ui-icon-radio-on.ui-icon{
        background-color:red;
    }​
    

    Sample jsfiddle.

    To style Horizontally stacked select options:

    Screenshot2 Horizontally stacked

    .ui-radio:nth-child(1) .ui-radio-on span.ui-btn-inner{
        background-color:green;
    }
    .ui-radio:nth-child(2) .ui-radio-on span.ui-btn-inner{
        background-color:grey;
    }
    .ui-radio:nth-child(3) .ui-radio-on span.ui-btn-inner{
        background-color:red;
    }​
    

    Sample jsfiddle.

提交回复
热议问题