在向下滚动的页面的中心显示引导模式

时间:2017-06-06 08:36:48

标签: css twitter-bootstrap bootstrap-modal

我正在使用ace admin template来开发一个网站,但是当我向下滚动它时,我将问题放在iframe页面的中心,就像这样。

$('#modalId').modal({
    show:true,
    backdrop:'static'
})

如何在当前视图的中心弹出模态?

3 个答案:

答案 0 :(得分:1)

var scrollTop = window.gui.getTopWindow(window).scrollY;
if(scrollTop > 200){
    $('#modalId').find('.modal-content').css('top',(scrollTop-50)+'px');
}
$('#modalId').modal({
    show:true,
})

答案 1 :(得分:1)

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">

    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/WEB-INF/classes/static/login/*</url-pattern>
    </servlet-mapping>

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Authentication</web-resource-name>
            <url-pattern>/test/auth/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>users</role-name>
        </auth-constraint>
    </security-constraint>

    <login-config>
        <auth-method>FORM</auth-method>
        <form-login-config>
            <form-login-page>/WEB-INF/classes/static/login/login.html</form-login-page>
            <form-error-page>/WEB-INF/classes/static/login/loginerror.html</form-error-page>
        </form-login-config>
    </login-config>

    <security-role>
        <role-name>users</role-name>
    </security-role>

</web-app>

答案 2 :(得分:0)

<script language="javascript">
    this.getTopWindow(window).ui_confirm(content);

    function ui_confirm(msg, confirm, cancel){
        bootbox.dialog({
            message: "<h5>"+msg+"<h5>",
            animate: false,
            closeButton: false,
            size: "small",
            buttons: {
                main: {
                    label: "取消",
                    className: "btn-inverse btn-sm",
                    callback: function() {
                        if (typeof cancel !== "undefined" && Object.prototype.toString.call(cancel) === "[object Function]") {
                            cancel();
                        }
                    }
                },
                danger: {
                    label: "确定",
                    className: "btn-primary btn-sm",
                    callback: function() {
                        if (typeof confirm !== "undefined" && Object.prototype.toString.call(confirm) === "[object Function]") {
                            confirm();
                        }
                    }
                }
            }
        });
    }
</script>