Added event hadler to toggle quake mapkey.
This commit is contained in:
parent
8cafc17840
commit
23ea60ba31
Notes:
subgit
2018-03-07 17:58:39 +01:00
r476 www/trunk
50
index.html
50
index.html
@ -4,26 +4,9 @@
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
||||
<title>RUB SeisObs - Station and Seismicity Map</title>
|
||||
<style type="text/css">
|
||||
.olControlAttribution {
|
||||
position: absolute;
|
||||
font-size: 10px;
|
||||
text-align: left;
|
||||
color: #eeeeee;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right:auto !important;
|
||||
background: #130085; /* fallback for IE - IE6 requires background shorthand*/
|
||||
background: rgba(0, 60, 136, 0.3);
|
||||
filter: alpha(opacity=30);
|
||||
font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
|
||||
border-radius: 5px 0 0 0;
|
||||
}
|
||||
.olControlAttribution a {
|
||||
color: #eeeeee;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<style type="text/css">
|
||||
html, body, #map {
|
||||
margin: 0;
|
||||
@ -54,9 +37,26 @@
|
||||
padding: 0px 0px 0px 0px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<style type="text/css">
|
||||
.olControlAttribution {
|
||||
position: absolute;
|
||||
font-size: 10px;
|
||||
text-align: left;
|
||||
color: #eeeeee;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right:auto !important;
|
||||
background: #130085; /* fallback for IE - IE6 requires background shorthand*/
|
||||
background: rgba(0, 60, 136, 0.3);
|
||||
filter: alpha(opacity=30);
|
||||
font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
|
||||
border-radius: 5px 0 0 0;
|
||||
}
|
||||
.olControlAttribution a {
|
||||
color: #eeeeee;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript' src='OpenLayers.js'></script>
|
||||
<script type='text/javascript' src='https://maps.google.com/maps/api/js?sensor=false&v=3.9'></script>
|
||||
<script type='text/javascript' src='station_map_www.js'></script>
|
||||
@ -77,9 +77,9 @@
|
||||
});
|
||||
OpenLayers.Lang.setCode(document.documentElement.lang);
|
||||
</script>
|
||||
<!-- <div id="mapkey">
|
||||
<div id="mapkey">
|
||||
<script type='text/javascript'>initKey(true, false, false);</script>
|
||||
</div> -->
|
||||
</div>
|
||||
<div id="map">
|
||||
<script type='text/javascript'>init(true, true, false, false);</script>
|
||||
</div>
|
||||
|
@ -127,6 +127,7 @@ function init(showGoogle, showStations, showQuakes, noFrils) {
|
||||
|
||||
// Show quakes
|
||||
quakes_layer = loadKML(OpenLayers.i18n("Events"), 'quakes.kml', false, true);
|
||||
quakes_layer.events.on({'visibilitychanged': toggleQuakesMapkey});
|
||||
map.addLayer(quakes_layer);
|
||||
quakes_layer.setVisibility(showQuakes);
|
||||
|
||||
@ -295,7 +296,7 @@ function onPopupClose(evt) {
|
||||
select.unselectAll();
|
||||
}
|
||||
|
||||
/* Function called when clicking on a markger */
|
||||
/* Function called when clicking on a marker */
|
||||
function onFeatureSelect(event) {
|
||||
var feature = event.feature;
|
||||
// Since KML is user-generated, do naive protection against
|
||||
@ -337,3 +338,14 @@ function onFeatureUnselect(event) {
|
||||
delete feature.popup;
|
||||
}
|
||||
}
|
||||
|
||||
/* Function to activate map legend */
|
||||
function toggleQuakesMapkey() {
|
||||
var mapkey_div = document.getElementById('mapkey');
|
||||
var quakes_visibility = quakes_layer.getVisibility();
|
||||
if (quakes_visibility) {
|
||||
mapkey_div.style.display = "block";
|
||||
} else {
|
||||
mapkey_div.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user