模态隐藏后更改 css 样式

change css style after modal is hide

当我点击我的 table 行时,会出现模态 window 并且更改 "tr" 背景颜色表示每一行都是模态打开的。但是,当我关闭时,tr 的模态背景颜色保持不变。如何更改为默认值?

<tr class='revisions'>
      <td>{{ $revision->date_of_revision->format('d.m.Y') }}
      </td>

<td class="text-right">
                    <a  
                       data-toggle="modal" 
                       data-target="#revisionEdit" 
                       class='btn btn-warning revisionEdit'>
                        <span class="glyphicon glyphicon-pencil"></span>
                    </a>

</td>
</tr>

您可以在模式弹出窗口关闭时绑定一个事件。检查 the answer

$('#myModal').on('hidden.bs.modal', function () { // do something… })

getbootstrap.com/javascript/#modals-events

如果您使用 JavaScript 更改颜色,那么您可以使用 Bootstrap 模式事件在隐藏时将其改回。

    $('.modal').on('hidden.bs.modal', function (e) {
        $("selector").css("background-color", "#EEEEEE");
    });

根据w3fools

show.bs.modal Occurs when the modal is about to be shown.
shown.bs.modal Occurs when the modal is fully shown (after CSS transitions have completed)
hide.bs.modal Occurs when the modal is about to be hidden
hidden.bs.modal Occurs when the modal is fully hidden (after CSS transitions have completed)