Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

terms&service onload popup

I need a terms and service popup as soon as the page loads how can I do that with html, javascript , css . please help.so basically as soon as I load to my website there is a pop up with terms and service which I have ready .

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

based on this reference – codepen ref

$(function() {
  var overlay = $('<div id="overlay"></div>');
  overlay.show();
  overlay.appendTo(document.body);
  $('.popup-onload').show();
  $('.close').click(function() {
    $('.popup-onload').hide();
    overlay.appendTo(document.body).remove();
    return false;
  });

  $('.x').click(function() {
    $('.popup').hide();
    overlay.appendTo(document.body).remove();
    return false;
  });
});
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  filter: alpha(opacity=70);
  -moz-opacity: 0.7;
  -khtml-opacity: 0.7;
  opacity: 0.7;
  z-index: 100;
  display: none;
}

.cnt223 a {
  text-decoration: none;
}

.popup-onload {
  width: 100%;
  margin: 0 auto;
  display: none;
  position: fixed;
  z-index: 101;
}

.cnt223 {
  min-width: 600px;
  width: 600px;
  min-height: 150px;
  margin: 100px auto;
  background: #f3f3f3;
  position: relative;
  z-index: 103;
  padding: 15px 35px;
  border-radius: 5px;
  box-shadow: 0 2px 5px #000;
}

.cnt223 p {
  clear: both;
  color: #555555;
  /* text-align: justify; */
  font-size: 20px;
  font-family: sans-serif;
}

.cnt223 p a {
  color: #d91900;
  font-weight: bold;
}

.cnt223 .x {
  float: right;
  height: 35px;
  left: 22px;
  position: relative;
  top: -25px;
  width: 34px;
}

.cnt223 .x:hover {
  cursor: pointer;
}
<script src="https://code.jquery.com/jquery-1.8.2.js"></script>
<div class='popup-onload'>
  <div class='cnt223'>

    <p>
      Terms and conditions
      <br/>
      <br/>
      <a href='' class='close'>Close</a>
    </p>
  </div>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading