如果按钮未放置在模态体内,请关闭自举模式

时间:2015-06-19 18:50:44

标签: jquery html css twitter-bootstrap bootstrap-modal

所以,我有这个模态我用于全屏菜单,关闭按钮在这种形式下完美运行:

<div class="modal fade" id="hidden-links">
    <div class="modal-dialog">
        <div class="modal-content hidden-links">
            <div class="modal-body">
                <div data-dismiss="modal" aria-label="Close">
                    <i class="fa fa-times fa-fw fa-2x"></i>
                </div>
                <ul class="links-hidden" role="menu">
                <!--Hidden links here-->
                </ul>
            </div>
        </div>
    </div>
</div>

我要做的就是搬家:

<div data-dismiss="modal" aria-label="Close">
    <i class="fa fa-times fa-fw fa-2x"></i>
</div>
<{1>}中的

所以我可以实现这样的目标:

enter image description here

我已经做了一些挖掘,但我找不到合适的解决方案来解决我的问题,任何想法?

1 个答案:

答案 0 :(得分:3)

稍微更改标记:

<div class="modal fade" id="hidden-links">
    <div data-dismiss="modal" aria-label="Close">
        <i class="fa fa-times fa-fw fa-2x"></i>
    </div>
    <div class="modal-dialog">
        <div class="modal-content hidden-links">
            <div class="modal-body">
                <ul class="links-hidden" role="menu">
                    <!--Hidden links here-->
                </ul>
            </div>
        </div>
    </div>
</div>

然后添加CSS:

div[data-dismiss="modal"]{
  color:#ffffff;
  position:fixed;
  top:10px;
  right:20px;
  cursor:pointer;
}

See it in action here