-2

On this example: HTML / CSS Popup div on text click

How can I make this load on the index page when they visit the site the first time. I don't want a button to click, I want this load automatically; and then have a close button when they read the content on the popup. Thanks in advance.

Community
  • 1
  • 1

1 Answers1

0

Hi you can do this using bootstrap model popup for this include bootstrap css and js files and use below code

Your Html Code

<div class="modal fade" id="myModal" tabindex="-1" role="dialog"  arialabelledby="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">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Intorduction</h4>
      </div>
      <div class="modal-body">
        Body Text
      </div>
      <div class="modal-footer">
        <a  class="btn btn-default"  data-dismiss="modal">Close</a>

      </div>
    </div>
  </div>
</div>

then use this script

<script>
      if (localStorage.getItem('showModal')!='yes')
        {
        localStorage.setItem('showModal','yes');
        $('#myModal').modal('show');

        }

 </script>
Lokesh Daiya
  • 799
  • 1
  • 8
  • 14