繁体   English   中英

会话中一次显示模态窗口

[英]One time show modal window in session

第一次登录站点时,只需要显示一次模态窗口(引导程序)。 我不能做什么?

模态窗

         <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel">Przeczytaj zanim zaczniesz!</h4>
                        </div>
                        <div class="modal-body">
     ..........................

                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        </div>
                    </div>
                </div>
            </div>

JS

    $(window).load(function () {
                    $('#myModal').modal('show');
                });

简单地从服务器端在jsp中嵌入变量(无论是否使用框架,都应为idk);

request.setAttribute("isLoginPage", true);

并假设您将jstl和jsp一起使用;

<script>
  <c:if test="${isLoginPage}">
    // your js code here
  </c:if>
</script>

您可以使用此处回答的java来获得相同的结果。

或仅使用javascript,或者您可以使用来获取当前网址;

var url = window.location.href;

并检查URL是否为登录URL。 但是,该方法不适用于单页应用程序。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM