OMS2021 - Template

by John Doe

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css">
<script src="https://raw.githack.com/Nycto/PicoModal/master/src/picoModal.js"></script>
<link rel="stylesheet" href="https://raw.githubusercontent.com/onaci/leaflet-velocity/master/dist/leaflet-velocity.css">
<script src="https://raw.githubusercontent.com/onaci/leaflet-velocity/master/dist/leaflet-velocity.js"></script>
<head>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Audiowide">
</head>
<body>
  <div id="map_title" class="title">Title of the map</div>
  <div id="map"></div>
  <div id="act_btn" class="hover_btn button">Open window</div>
</body>

CSS

/* **************************** */
/* TRY AND CHANGE THESE OPTIONS */
/* **************************** */
.button {
  /* weight of the font, try changing this to 200 */
  font-weight: 700;
  
  /* size of the font, try changing this to 30px */
  font-size:30px;
  
  /* color of the background, try changing this to black */
  background-color: white;
  
  /* color of the words inside, try changing this to orange */
  color: black;
 
  /* try changing these and see what happens :) */
  right: 10px;
  bottom: 10px;
}

/* title of the map */
.title {
  /* color of the words inside, try changing this to orange */
  color: white;
  
  /* size of the font, try changing this to 40px */
  font-size: 20px;
}




/* *********************************** */
/* YOU CAN ALSO CHANGE THESE, BUT THAT */
/* MIGHT BREAK STUFF :)                */
/* *********************************** */
body {
  margin: 0px;
  font-family: 'Audiowide';
}

#map {
  position: absolute;
  height: 100%;
  width: 100%;
  background-color: #333;
}
#map_title {
  position: absolute;
  z-index: 1000;
  top: 10px;
  left: 60px;
}

.leaflet-control-attribution {
  display: none;
}

#act_btn {
  cursor: pointer;
  position: absolute;
  z-index: 1000;
  border-radius: 5px;
  text-align: center;
  width: 242px;
  box-shadow: 0 3px 14px rgb(0 0 0 / 40%);
  padding: 5px 10px;
}

.modal {
  display: none;
}

.modal.is-open {
  display: block;
}

JavaScript

// create a map
const map = L.map('map').setView([35.0, -20.0], 2);

// add basemap
const basemap = L.tileLayer('https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/{z}/{x}/{y}{r}.png').addTo(map);

/* add wind */
// load and show the wind
fetch('https://raw.githubusercontent.com/onaci/leaflet-velocity/master/demo/wind-global.json').then(res => res.json()).then((data) => { L.velocityLayer({data:data, displayValues:false}).addTo(map) });



// what happens on button click

const button = document.querySelector('#act_btn');
button.onclick = () => {
	let text = "And now for something completely different";
  picoModal(text).show();
}