Disable Twitter Bootstrap Button Group

前端 未结 4 459
萌比男神i
萌比男神i 2021-01-17 20:06

I have a button group on a page that is used for a selection. After the selection is made I want the button group to still be visible so the user can see the selection they

4条回答
  •  星月不相逢
    2021-01-17 20:51

    I wanted to keep the styling too, So I left out the disabled field and just counter-acted the CSS with a new class display-only:

    And the CSS:

    .btn-group.display-only label.btn {
        pointer-events: none;
        cursor: not-allowed;
    }
    .btn-group.display-only label.btn.active {
        opacity: 1;
        color: #333;
        background-color: #e6e6e6;
        border-color: #adadad;webkit-box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
        box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
    }
    

    ..Seems to work well for me.

提交回复
热议问题