mirror of
				https://github.com/KevinMidboe/OverlappingGeoJSON_Panes_Template.git
				synced 2025-10-29 17:50:29 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			200 lines
		
	
	
		
			7.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			200 lines
		
	
	
		
			7.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!DOCTYPE html>
 | 
						|
<html lang="en">
 | 
						|
  <head>
 | 
						|
    <meta charset="utf-8">
 | 
						|
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
						|
    <meta name="viewport" content="width=device-width, initial-scale=1">
 | 
						|
    <title>Atlas index with menu</title>
 | 
						|
 | 
						|
    <!-- Mapbox.js -->
 | 
						|
    <meta name="viewport" content="initial-scale=1.0, initial-scale=1.0">
 | 
						|
    <script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js'></script>
 | 
						|
    <link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.css' rel='stylesheet' />
 | 
						|
 | 
						|
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
 | 
						|
 | 
						|
 | 
						|
  <style>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
  body { margin:0; padding:0;
 | 
						|
      }
 | 
						|
    #map { position:absolute; top:0; bottom:0; width:100%; }
 | 
						|
          .leaflet-control-zoom {
 | 
						|
              left: 9px;
 | 
						|
              top: 15px;
 | 
						|
            }
 | 
						|
  .btn-custom {
 | 
						|
  background-color: hsl(197, 46%, 41%) !important;
 | 
						|
  background-repeat: repeat-x;
 | 
						|
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#489abb", endColorstr="#387d98");
 | 
						|
  background-image: -khtml-gradient(linear, left top, left bottom, from(#489abb), to(#387d98));
 | 
						|
  background-image: -moz-linear-gradient(top, #489abb, #387d98);
 | 
						|
  background-image: -ms-linear-gradient(top, #489abb, #387d98);
 | 
						|
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #489abb), color-stop(100%, #387d98));
 | 
						|
  background-image: -webkit-linear-gradient(top, #489abb, #387d98);
 | 
						|
  background-image: -o-linear-gradient(top, #489abb, #387d98);
 | 
						|
  background-image: linear-gradient(#489abb, #387d98);
 | 
						|
  border-color: #387d98 #387d98 hsl(197, 46%, 38.5%);
 | 
						|
  color: #fff !important;
 | 
						|
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.16);
 | 
						|
  -webkit-font-smoothing: antialiased;
 | 
						|
  }
 | 
						|
  h3 {
 | 
						|
    background-color: black;
 | 
						|
  }
 | 
						|
  .maptext {
 | 
						|
    position:fixed;
 | 
						|
    font-size:24px;
 | 
						|
    color:white;
 | 
						|
    font-family: Arial,Helvetica Neue,Helvetica,sans-serif;
 | 
						|
    left:50%;
 | 
						|
    top:10%;
 | 
						|
    transform: translate(-50%, -50%);
 | 
						|
  }
 | 
						|
  .custom-popup .leaflet-popup-content-wrapper {
 | 
						|
    text-align:center;
 | 
						|
  }
 | 
						|
  .custom-popup .leaflet-popup-content-wrapper a {
 | 
						|
  }
 | 
						|
  .menu-ui {
 | 
						|
  background:#fff;
 | 
						|
  position:absolute;
 | 
						|
  top:20px;right:10px;
 | 
						|
  z-index:1;
 | 
						|
  border-radius:3px;
 | 
						|
  width:60px;
 | 
						|
  border:1px solid rgba(0,0,0,0.4);
 | 
						|
  }
 | 
						|
 .menu-ui a {
 | 
						|
    font-size:14px;
 | 
						|
    color:#212121;
 | 
						|
    display:block;
 | 
						|
    margin:0;padding:0;
 | 
						|
    padding:2.5px;
 | 
						|
    text-decoration:none;
 | 
						|
   font-family: Arial,Helvetica Neue,Helvetica,sans-serif;
 | 
						|
    border-bottom:1px solid rgba(0,0,0,0.25);
 | 
						|
    text-align:center;
 | 
						|
    }
 | 
						|
   .menu-ui a:first-child {
 | 
						|
      border-radius:3px 3px 0 0;
 | 
						|
      }
 | 
						|
    .menu-ui a:last-child {
 | 
						|
      border:none;
 | 
						|
      border-radius:0 0 3px 3px;
 | 
						|
      }
 | 
						|
    .menu-ui a:hover {
 | 
						|
      background:#e9e8e8;
 | 
						|
      color:#212121;
 | 
						|
      padding:8px;
 | 
						|
      }
 | 
						|
    .menu-ui a.active {
 | 
						|
      background:#3887BE;
 | 
						|
      color:#FFF;
 | 
						|
      }
 | 
						|
      .menu-ui a.active:hover {
 | 
						|
        background:#3074a4;
 | 
						|
        }
 | 
						|
  </style>
 | 
						|
 | 
						|
  </head>
 | 
						|
  <body>
 | 
						|
 | 
						|
  <nav id='menu-ui' class='menu-ui'></nav>
 | 
						|
  <div class='custom-popup' id='map'>
 | 
						|
 | 
						|
  </div>
 | 
						|
  <div class='maptext'>
 | 
						|
    <h3>Atlantic Neptune, Volume 1, Part 1a</h3>
 | 
						|
  </div>
 | 
						|
</div>
 | 
						|
  <script>
 | 
						|
  L.mapbox.accessToken = 'pk.eyJ1IjoiZXZhbnRob3JuYmVycnkiLCJhIjoiemVQMDBUdyJ9.aK0EfwMvPgquXMmxLf73lw';
 | 
						|
  // !!!Change setView location if needed - http://leafletjs.com/examples/quick-start-example.html
 | 
						|
           // Tiles and loading location
 | 
						|
           var tiles = L.tileLayer('http://b.tile.stamen.com/toner-lite/{z}/{x}/{y}.png', {
 | 
						|
       	transparency: true,
 | 
						|
       	attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.  Representative of the holdings at <a href="http://maps.bpl.org" target="_blank"><strong>The Leventhal Map Center</strong></a>.'}
 | 
						|
       	);
 | 
						|
   var map = L.map('map', {
 | 
						|
  
 | 
						|
   })
 | 
						|
       .addLayer(tiles)
 | 
						|
       .setView([46.06942, -63.68774], 6);
 | 
						|
          // *Change max and min zoom levels
 | 
						|
var layers = document.getElementById('menu-ui');
 | 
						|
  
 | 
						|
  var style1 = {
 | 
						|
      color:"#4ba8a7", opacity:".8", weight:"2",fillOpacity:".3",};
 | 
						|
  var style1mo = {
 | 
						|
      color:"#4ba8a7", opacity:".8", weight:"4", fillOpacity:".5"};
 | 
						|
  
 | 
						|
  // this function creates a popup showing the layer name
 | 
						|
  function onEachFeature1(feature, layer) {
 | 
						|
      {
 | 
						|
          layer.bindPopup("This is <em>" + feature.properties.title + "</em> from The Atlantic Neptune, Volume 1, Part 1a" + ' </br></br><a class="btn btn-custom btn-sm" href="' + layer.feature.properties.url + '" role="button" target="_blank">view original<\/a>');
 | 
						|
 | 
						|
          layer.setStyle(style1);
 | 
						|
          (function (layer, properties){
 | 
						|
          	layer.on("mouseover", function(e){
 | 
						|
          		layer.setStyle(style1mo);
 | 
						|
          	});
 | 
						|
          	layer.on("mouseout", function(e){
 | 
						|
          		layer.setStyle(style1);
 | 
						|
          	});
 | 
						|
          })(layer, feature.properties);
 | 
						|
      }
 | 
						|
  };
 | 
						|
     
 | 
						|
        $.getJSON("https://raw.githubusercontent.com/ect123/Des-Barres-findingaid/master/maps/1-1a-6.geojson",function(data){
 | 
						|
        addLayer(L.geoJson(data, {onEachFeature: onEachFeature1} ), '6', -2);
 | 
						|
        });
 | 
						|
        $.getJSON("https://raw.githubusercontent.com/ect123/Des-Barres-findingaid/master/maps/1-1a-8.geojson",function(data){
 | 
						|
        addLayer(L.geoJson(data, {onEachFeature: onEachFeature1} ), '8', -1);
 | 
						|
        });              
 | 
						|
        $.getJSON("https://raw.githubusercontent.com/ect123/Des-Barres-findingaid/master/maps/1-1a-13.geojson",function(data){
 | 
						|
        addLayer(L.geoJson(data, {onEachFeature: onEachFeature1} ), '13', 0);
 | 
						|
        });   
 | 
						|
        $.getJSON("https://raw.githubusercontent.com/ect123/Des-Barres-findingaid/master/maps/1-1a-15.geojson",function(data){
 | 
						|
        addLayer(L.geoJson(data, {onEachFeature: onEachFeature1} ), '15', 1);
 | 
						|
        });
 | 
						|
        $.getJSON("https://raw.githubusercontent.com/ect123/Des-Barres-findingaid/master/maps/1-1a-10.geojson",function(data){
 | 
						|
        addLayer(L.geoJson(data, {onEachFeature: onEachFeature1} ), '10', 2);
 | 
						|
        });
 | 
						|
     
 | 
						|
        function addLayer(layer, name, zIndex){
 | 
						|
        	layer
 | 
						|
        		.setZIndex(zIndex)
 | 
						|
        		var link = document.createElement('a');
 | 
						|
                link.href = '#';
 | 
						|
                link.className = '';
 | 
						|
                link.innerHTML = name;
 | 
						|
            link.onclick = function(e) {
 | 
						|
                e.preventDefault();
 | 
						|
                e.stopPropagation();
 | 
						|
                if (map.hasLayer(layer)) {
 | 
						|
                    map.removeLayer(layer);
 | 
						|
                    this.className = '';
 | 
						|
                } else {
 | 
						|
                    map.addLayer(layer);
 | 
						|
                    this.className = 'active';
 | 
						|
                }
 | 
						|
            };
 | 
						|
            layers.appendChild(link);
 | 
						|
        }
 | 
						|
  </script>
 | 
						|
 | 
						|
  <script>
 | 
						|
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
 | 
						|
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 | 
						|
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 | 
						|
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
 | 
						|
    ga('create', 'UA-47313789-1', 'auto');
 | 
						|
    ga('send', 'pageview');
 | 
						|
  </script>
 | 
						|
 | 
						|
  </body>
 | 
						|
  </html>
 |