Twitter引导模式淡入并在手动切换半秒后消失

Twitter bootstrap modal fade in and disappears after a half second on manual toggle

本文关键字:消失 半秒 模式 淡入 Twitter      更新时间:2023-09-26

在将显示模式切换到手动模式之前,我的模式工作良好。我用以下简化的javascript代码调用模态:

var dlg = $('#loginDlg');
dlg.modal({show:false});
if(loggedIn) {
  logout();
} else {
  dlg.modal('show');
}

我使用bootstrap作为流星插件,所以只包含bootstrap.js

我的标记:

<button type="button" class="btn btn-large span1" id="login" role="button"
        data-toggle="modal" data-target="#loginDlg">
  <i class="icon-off pull-right"></i>
</button>
<div class="modal hide fade" id="loginDlg" tabindex="-1"
     role="dialog" aria-labelledby="loginDlgLabel" aria-hidden="true">
  ---
</div>

也许我必须更改标记?

编辑:

解决方案:我必须删除按钮标记中的data-target属性!使用此属性,bootstrap可以切换模态两次。

解决方案:我不得不删除按钮标记中的data-target属性!使用此属性,bootstrap可以切换模态两次。