简体   繁体   中英

on load open model popup using bootstrap?

model is opening on click :

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

my model code is :

 <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>

How can I open model on load ?

Try this,

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

Assuming you are using remodal , you could just programmatically open the model on your onload event. Something like this:

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

See demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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