Skip to content
test-div-overlay.html 2.42 KiB
Newer Older
<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>test pop up window (overlay) </title>
    <style type="text/css">
      #container {
	  width: 700px;
	  margin: 0 auto;
      }
      .overlay {
	  display: none;
      }
      #overlay1-container {
	  width: 700px;
	  height: 90vh;
	  /* background: rgba(0,0,0,0.4); */
	  /* background: rgba(135,206,235,0.8); */
	  background: rgba(65,105,225,0.2);
	  /* border: 1px skyblue solid; */
	  position: fixed;
	  top: 10px;
      }
      #overlay1-content {
	  width: 400px;
	  height: 300px;
	  /* border: 1px red solid; */
	  margin: 20px auto;
	  background: white;
	  box-shadow: 3px 3px 3px black;
	  padding: 20px;
      }
      #close-overlay1 {
	  position: relative;
	  left: 100px;
      }
      #overlay2 {
	  width: 200px;
	  height: 150px;
	  border: 1px red solid;
	  position: fixed;
	  top: 10px;
	  background: white;
      }
    </style>
  </head>

  <body>
    <div id="container">
      <h3>My Page
	<a id="show-overlay1" href="#">overlay1</a>
	<a id="show-overlay2" href="#">overlay2</a>
      </h3>
      <p>This is the default page content</p>

      <div id="overlay1-container" class="overlay">
	<div id="overlay1-content">
	  <h3>This is overlay title <a id="close-overlay1" href="#">close</a></h3>
	  <p>This is overlay content</p>
	</div>
      </div>

      <div id="overlay2" class="overlay">
	<h3>This is overlay title <a id="close-overlay2" href="#">close</a></h3>
	<p>This is overlay content</p>
      </div>
    </div>

    <script type="text/javascript" src="vendor/jquery.min.js"></script>
    <script type="text/javascript">
      $('#show-overlay1').click(function (evt) {
	  $('#overlay1-container').show();
	  return false;
      });
      $('#show-overlay2').click(function (evt) {
	  $('#overlay2').show();
	  return false;
      });
      $('#close-overlay1').click(function (evt) {
	  $('#overlay1-container').hide();
	  return false;
      });
      $('#close-overlay2').click(function (evt) {
	  $('#overlay2').hide();
	  return false;
      });
      $('#overlay1-container').click(function (evt) {
	  $('#overlay1-container').hide();
      });
      $('#overlay1-content').click(function (evt) {
	  // do nothing.
	  return false;
      });

      // page init
      $('#overlay1-container').show();
      // $('#overlay2').show();
    </script>
  </body>

</html>