使用 bootstrap 加载打开模式弹出窗口?

on load open model popup using bootstrap?

点击打开模型:

 <a href="#" data-remodal-target="test" >test</a>

我的型号代码是:

 <div class="remodal" data-remodal-id="test">
    <h3 class="modal-middle-heading">Buy</h3>
    <p>Please select your desired gift city.</p>
    <form class="login-form">
        <input type="text" placeholder="Search City" />
    </form>
    <button>Search</button>
</div>

如何在加载时打开模型?

试试这个,

<script type="text/javascript">
    $(window).load(function(){
        $('#test').modal('show');
    });
</script>

假设您使用的是 remodal,您可以通过编程方式在 onload 事件中打开模型。像这样:

  window.onload = function () {                                                
    $('[data-remodal-id=test]').remodal().open();                              
  }; 

demo