我根本不懂javascript.引导文档说到
通过javascript调用模态:$('#myModal').modal(options)
我不知道如何在页面加载时调用它.使用引导页面上提供的代码,我可以在单击元素时成功调用Modal,但我希望它在页面加载时立即加载.
我有一个带有bootstrap模式的页面(手册:http://getbootstrap.com/javascript/#modals).
我想在页面加载时打开这个模态.然而,这并没有发生.
<!-- Modal -->
<div class="modal fade" id="memberModal" tabindex="-1" role="dialog" aria-labelledby="memberModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="memberModalLabel">Thank you for signing in!</h4>
</div>
<div class="modal-body">
<p>However the account provided is not known.<BR>
If you just got invited to the group, please wait for a day to have the database synchronized.</p>
<p>You will now be shown the Demo site.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button> …Run Code Online (Sandbox Code Playgroud) 我制作了一个HTML和CSS页面,展示了我的网络应用程序的功能.现在我希望此页面仅为新访问者加载.如果返回的访问者访问我的域名,则应将他/她重定向到网络平台.
基本上,新用户应该看到"登陆页面",而返回的用户应该被重定向到"Web平台"
如果可能的话,我宁愿使用直接javascript到我的index.html文件中.我假设LocalStorage可以在这里提供帮助.但我诚实地对任何解决方案持开放态度.谢谢.
如何在页面加载时自动加载Bootstrap模型?
我尝试将以下内容添加到我的索引文件中:
<script type="text/javascript">
$(window).load(function () {
$('#myModal').modal('show');
});
</script>
Run Code Online (Sandbox Code Playgroud)
但它不起作用.