加载页面时如何自动激活模式?
How to automatically active a modal when loading a page?
我想知道在重定向过程中,我如何能够在一个模式已经处于活动状态的页面中重定向。
我试过的
<h2>Example of creating Modals with Twitter Bootstrap</h2>
<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" data-backdrop="show"> Launch demo modal </button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"> × </button>
<h4 class="modal-title" id="myModalLabel"> This Modal title
可以使用javascript/jquery吗?
如果您可以使用它们,您可以在页面加载后制作一个脚本 运行,其中包含
$('#myModal').modal('show');
使用
$('.myModal').modal('show')
别忘了包括 bootstrap JS ..
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/js/bootstrap.min.js"></script>
版本可能基于您的依赖关系
我想知道在重定向过程中,我如何能够在一个模式已经处于活动状态的页面中重定向。
我试过的
<h2>Example of creating Modals with Twitter Bootstrap</h2>
<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" data-backdrop="show"> Launch demo modal </button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"> × </button>
<h4 class="modal-title" id="myModalLabel"> This Modal title
可以使用javascript/jquery吗?
如果您可以使用它们,您可以在页面加载后制作一个脚本 运行,其中包含
$('#myModal').modal('show');
使用
$('.myModal').modal('show')
别忘了包括 bootstrap JS ..
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/js/bootstrap.min.js"></script>
版本可能基于您的依赖关系