Bootstrap 3 button group: corner radius disappears after a button is hidden

后端 未结 3 1573
予麋鹿
予麋鹿 2021-01-01 23:56

I have the following Bootstrap 3 button group:

3条回答
  •  悲&欢浪女
    2021-01-02 00:57

    AngularJS solution

    For pure jQuery projects, Josh Croziers answer is correct.

    But if you happen to be using AngularJS, there is a much simpler solution:

    Add an ng-if="expression" to the button. When expression is true, the button will be shown, otherwise it will be removed from the DOM completely. This makes the "new" first button have rounded corners, because the :first-child selector that Bootstrap uses now selects that one.

提交回复
热议问题