Hi,
1 Page show event fires every time you have visited a page.
It could be that there is some error with attach this event handler to your JS.
Please show us screen shots how do you use it event and call certain functions.
2 You don't need to create new map.
You have to stylize existing map instead of create in new one.
There is simple solution for your.
Please follow these steps to get it work correctly:
1 On pageShow javascript event handler paste following code:
precode
//Where "googlemap_6" is gmap component name.
initMapStyles("googlemap_6");
/code
/pre
2 Open your js asset (with initialize function). Delete initialize function at all. And fill this asset with following code:
precode
function initMapStyles(mapName) {
Code: Select all
// Create an array of styles.
var styles = [{
stylers: [{
hue: "#00ffe6"
}, {
saturation: -20
}]
}, {
featureType: "road",
elementType: "geometry",
stylers: [{
lightness: 100
}, {
visibility: "simplified"
}]
}, {
featureType: "road",
elementType: "labels",
stylers: [{
visibility: "off"
}]
}];
// Create a new StyledMapType object, passing it the array of styles,
// as well as the name to be displayed on the map type control.
var styledMap = new google.maps.StyledMapType(styles, {
name: "Styled Map"
});
var map = Appery("googlemap_6").options.mapElement.gmap('get', 'map');
map.mapTypes.set('map_style', styledMap);
map.setMapTypeId('map_style');
};
/code/pre
Now you can work with this google maps component as earlier (without styles).