Escape game messages screen v1

Last Updated or created 2023-02-06

Today working on the backend engine and screens like this.
All text will be generated, and send from the server.

A local version to try in your browser: (optimized for 1920×1080 press F11!)

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Indie+Flower&family=Tangerine&display=swap" rel="stylesheet">

<style>

body {
    background: url("background.jpg");
    height: 1080px;
    width: 100%;
    text-align: center;
    margin: auto;
    font-family: 'Tangerine', cursive;
    color:#000;
	}
/* The Modal (background) */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  padding-top: 100px; /* Location of the box */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgb(0,0,0); /* Fallback color */
  background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

/* Modal Content */
.modal-content {
  background-image: url("note.jpg"); /* The image used */
  height: 788px; /* You must set a specified height */
  background-position: center; /* Center the image */
  background-repeat: no-repeat; /* Do not repeat the image */
  margin: auto;
  padding: 20px;
}

/* The Close Button */
.close {
 position: absolute; /*Can also be `fixed`*/
  color: #ff0000;
  		  font-size: 40px;
		  right: 550px;

  font-weight: bold;
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}
.topcontent {
        width: 400px;
        height: 200px;
        font-family: 'Indie Flower', cursive;
		  font-size: 40px;

        position: absolute; /*Can also be `fixed`*/
        left: 0;
        right: 350;
        top: -440;
        bottom: 0;
        margin: auto;
        /*Solves a problem in which the content is being cut when the div is smaller than its' wrapper:*/
        max-width: 100%;
        max-height: 100%;
        overflow: auto;
}
.playercontent {
        width: 400px;
        height: 200px;
        font-family: 'Indie Flower', cursive;
		  font-size: 40px;

        position: absolute; /*Can also be `fixed`*/
        left: 0;
        right: 300;
        top: -340;
        bottom: 0;
        margin: auto;
        /*Solves a problem in which the content is being cut when the div is smaller than its' wrapper:*/
        max-width: 100%;
        max-height: 100%;
        overflow: auto;
}
.content {
        width: 400px;
        height: 200px;
        font-family: 'Indie Flower', cursive;
		  font-size: 40px;

        position: absolute; /*Can also be `fixed`*/
        left: 0;
        right: 0;
        top: 100;
        bottom: 0;
        margin: auto;
        /*Solves a problem in which the content is being cut when the div is smaller than its' wrapper:*/
        max-width: 100%;
        max-height: 100%;
        overflow: auto;
}
</style>
</head>
<body>


<!-- Trigger/Open The Modal -->
<button id="myBtn">Incoming message</button>

<!-- The Modal -->
<div id="myModal" class="modal">
  <div class="topcontent">HQ</div>
  <div class="playercontent">Spy #1</div>

  <div class="content">We need the code now! Look for a yellow key</div>

  <!-- Modal content -->
  <div class="modal-content">
  
    <span class="close">close</span>
  </div>

</div>

<script>
// Get the modal
var modal = document.getElementById("myModal");

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal 
btn.onclick = function() {
  modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
span.onclick = function() {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}
</script>
Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *