Add Popups

This commit is contained in:
labcode-de 2017-06-04 23:36:58 +02:00
parent e86fc183d3
commit 8540b2c73c
No known key found for this signature in database
GPG Key ID: 9CDB093B80490C2F
2 changed files with 8 additions and 1 deletions

View File

@ -76,7 +76,7 @@ if (count($community) == 1) {
<script> <script>
var communityiesGeoJson = [] var communityiesGeoJson = []
<?php foreach (array_slice($community, 0) as $i => $value):?> <?php foreach (array_slice($community, 0) as $i => $value):?>
communityiesGeoJson.push({"geojson": "<?php echo $value['geojson'] ?>"}) communityiesGeoJson.push({"geojson": "<?php echo $value['geojson'] ?>", "name": "<?php echo $value['name'] ?>"})
<?php endforeach ?> <?php endforeach ?>
</script> </script>
<script src="js/comunitychoose.js"></script> <script src="js/comunitychoose.js"></script>

View File

@ -23,6 +23,13 @@ $(document).ready(function() {
} }
}).addTo(map) }).addTo(map)
community.on('click', mapChangeCommunity); community.on('click', mapChangeCommunity);
community.bindPopup(i.name)
community.on('mouseover', function (e) {
this.openPopup();
});
community.on('mouseout', function (e) {
this.closePopup();
});
}) })
}) })
}); });