您可以创建一个数组,例如包含地图样式的 gmapStyles 并在 mapSettings 对象中调用它。
查看下面函数中的 gmapStyles 数组。
我的地图看起来像这样http://voddemo.akkastech.com/category/2
<script>
function newStoreLocatorInit(element= jQuery('#bh-sl-map-container'), type, ls){
if(element.length > 0){
var gmapStyles = [
{"elementType": "labels","stylers": [{"visibility": "off"}]},
{"featureType": "administrative","elementType": "geometry","stylers": [{"visibility": "off"}]},
{"featureType": "administrative.land_parcel","stylers": [{"visibility": "off"}]},
{"featureType": "administrative.land_parcel", "elementType": "geometry", "stylers": [{"color": "#ee99e6"}]},
{"featureType": "administrative.neighborhood","stylers": [{"visibility": "off"}]},
{"featureType": "landscape.man_made","elementType": "geometry","stylers": [{"color": "#dfe4e6"}]},
{"featureType": "poi","stylers": [{"visibility": "off"} ] },
{"featureType": "poi.park", "elementType": "geometry", "stylers": [{"color": "#a0ec96"}]},
{"featureType": "road", "elementType": "geometry", "stylers": [{"color": "#bdc3cb"}]},
{"featureType": "road", "elementType": "labels.icon", "stylers": [{"visibility": "off"}]},
{"featureType": "transit", "stylers": [{"visibility": "off"}]}
];
element.storeLocator({
callbackSuccess : function(){
jQuery('.at-dataloader').fadeOut(300);
jQuery('.bh-sl-loc-list .list').fadeIn(300);
},
'infowindowTemplatePath' : '/assets/js/plugins/storeLocator/templates/infowindow-description.html',
'listTemplatePath' : '/assets/js/plugins/storeLocator/templates/location-list-description.html',
taxonomyFilters : {
'name':'name-filter',
'subcategoryname':'subcategoryname-filter',
'location':'location-filter',
'subcategoryid':'subcategoryid-filter'
},
/*distanceAlert: -1,*/
// querystringParams : true,
// fullMapStart:true,
disableAlphaMarkers : true,
dataType : 'json',
slideMap : false,
defaultLoc : true,
defaultLat : '44.9207462',
defaultLng : '-93.3935366',
visibleMarkersList : false,
listColor1 : '',
listColor2 : '',
/*maxDistance : false,*/
markerCluster : type != "true" ? {
zoomOnClick : true,
styles : [{
width : 40,
height : 40,
textSize : 14,
anchor : [60, 42],
textColor : '#fff',
backgroundSize : 'cover',
backgroundPosition : 'top, center',
cssClass : 'at-iconcluster',
url : '/images/svg/iconcluster.svg',
}]
} : null,
mapSettings : {
zoom : 11,
disableDefaultUI : true,
zoomControl : true,
styles : gmapStyles,
mapTypeId : google.maps.MapTypeId.ROADMAP,
// minZoom : 10,
// maxZoom : 12,
},
dataLocation : ls ,
// dataLocation : '/data/locations.json' ,
markerImg : '/images/svg/icon01.svg',
markerDim : {
width: 36,
height: 45
},
selectedMarkerImg : '/images/svg/icon02.svg',
selectedMarkerImgDim : {
width: 36,
height: 45
},
infoBubble: {
backgroundColor : '#fff',
borderRadius : 0,
borderWidth : 0,
closeSrc : '/assets/img/close-icon-dark.png',
disableAutoPan : false,
shadowStyle : 0,
padding : 0,
minWidth : 370,
maxHeight : 162,
backgroundClassName : 'bh-sl-window',
},
callbackMapSet : function(){
},
callbackMarkerClick : function(){
setTimeout(function(){
ajaxCallsOnPopupNavBtnClick()
jQuery(".at-btnthemecontent").animatedModal({
color: 'rgba(222, 226, 228, 0.85)',
modalTarget:'at-themecontent',
animatedOut:'zoomOut',
animatedIn:'zoomIn',
});
jQuery('.at-btnthemecontent').on('click', function(){
jQuery('.at-mlogo').addClass('at-hideui');
jQuery('.at-sidebar').addClass('at-hideui');
jQuery('.at-toprightbox').addClass('at-hideui');
jQuery('.gmnoprint.gm-bundled-control').addClass('at-hideui');
jQuery('.at-btnfindoutmore').addClass('at-hideui');
});
jQuery('.close-at-themecontent.at-btnclose').on('click', function(){
jQuery('.at-mlogo').removeClass('at-hideui');
jQuery('.at-sidebar').removeClass('at-hideui');
jQuery('.at-toprightbox').removeClass('at-hideui');
jQuery('.gmnoprint.gm-bundled-control').removeClass('at-hideui');
jQuery('.at-btnfindoutmore').removeClass('at-hideui');
});
}, 1000)
},
callbackListClick : function(){
setTimeout(function(){
ajaxCallsOnPopupNavBtnClick()
jQuery(".at-btnthemecontent").animatedModal({
color: 'rgba(222, 226, 228, 0.85)',
modalTarget:'at-themecontent',
animatedOut:'zoomOut',
animatedIn:'zoomIn',
});
jQuery('.at-btnthemecontent').on('click', function(){
jQuery('.at-mlogo').addClass('at-hideui');
jQuery('.at-sidebar').addClass('at-hideui');
jQuery('.at-toprightbox').addClass('at-hideui');
jQuery('.gmnoprint.gm-bundled-control').addClass('at-hideui');
jQuery('.at-btnfindoutmore').addClass('at-hideui');
});
jQuery('.close-at-themecontent.at-btnclose').on('click', function(){
jQuery('.at-mlogo').removeClass('at-hideui');
jQuery('.at-sidebar').removeClass('at-hideui');
jQuery('.at-toprightbox').removeClass('at-hideui');
jQuery('.gmnoprint.gm-bundled-control').removeClass('at-hideui');
jQuery('.at-btnfindoutmore').removeClass('at-hideui');
});
}, 1000)
},
callbackNoResults : function(){
alert('No locations were found with the given criteria. Please modify your selections or input.')
},
callbackFilters : function(){
}
});
}
}