MAPG-169 make static map background instead of img

This commit is contained in:
bence committed 2020-06-23 23:36:19 +02:00
1 parent dc4ba4b5a4
commit 394c8b8830
2 files changed
+6 -11

No files matched your search

+4 -6
View File
@@ -29,12 +29,10 @@ div.mapItem>div.title>p.title {
div.mapItem>div.imgContainer {
width: 100%;
padding-top: 50%;
background: #cccccc;
}
div.mapItem>div.imgContainer>img {
width: 100%;
margin-top: -50%
background-color: #cccccc;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
div.mapItem>div.inner {
+2 -5
View File
@@ -67,16 +67,13 @@ $cssFiles = [
for (var i = 0; i < imgContainers.length; i++) {
var imgContainer = imgContainers[i];
var img = document.createElement('img');
img.src = 'https://maps.googleapis.com/maps/api/staticmap?size=350x175&' +
var imgSrc = 'https://maps.googleapis.com/maps/api/staticmap?size=350x175&' +
'scale=' + (window.devicePixelRatio >= 2 ? 2 : 1) + '&' +
'visible=' + imgContainer.dataset.boundSouthLat + ',' + imgContainer.dataset.boundWestLng + '|' +
imgContainer.dataset.boundNorthLat + ',' + imgContainer.dataset.boundEastLng +
'&key=' + GOOGLE_MAPS_JS_API_KEY;
img.alt = 'Map area';
imgContainer.appendChild(img);
imgContainer.style.backgroundImage = 'url("' + imgSrc + '")';
}
})();
</script>