design
July 14, 2019, 3:29pm
1
var json = new google.maps.StyledMapType([
{
"featureType": "administrative.country",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#FFF"
}]
},
{
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#FFF"
},
{
"visibility": "inherit"
}]
},
{
"featureType": "water",
"stylers": [
{
"color": "#FFF"
}]
}],
{
name: 'DELTAONE'
});
How make this part of javascript to html with .data include jquery?
Like
<div data-json="json goes here?">
So how can combine the only json part be comes from html side data?
Thanks!
design
July 14, 2019, 4:36pm
3
camperextraordinaire:
ajax.getJSON
Because at html side easy can edit json file (color etc) in a text editor and no need to open remote files. I saw this method in a theme but can get that how work there sadly. P:)
With simple values is works on other elements but this include a function name inside json data that cant get how pass…
From theme:
* **data-map-style="JSON"** - Apply any style from[Snazzy Maps](http://snazzymaps.com/) or [make your own](https://mapstyle.withgoogle.com/).
Thanks!
design
July 14, 2019, 4:59pm
5
Sorry but that way what write at json var inside google maps js?
var json = new google.maps.StyledMapType([
how get here object?
…
Thanks!
Why not so something like the following?
const mapStyles = [
{
"featureType": "administrative.country",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#FFF"
}]
},
{
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#FFF"
},
{
"visibility": "inherit"
}]
},
{
"featureType": "water",
"stylers": [
{
"color": "#FFF"
}]
}],
{
name: 'DELTAONE'
});
];
var json = new google.maps.StyledMapType(mapStyles);
1 Like
design
July 14, 2019, 6:25pm
7
Uncaught SyntaxError: Invalid destructuring assignment target
At line: name: ‘DELTAONE’
Thanks!
design
July 14, 2019, 7:15pm
9
You are true but now not have idea how setup custom style name.