Remove google maps background-color

倾然丶 夕夏残阳落幕 提交于 2021-01-03 06:19:32

问题


I am trying to make my google maps transparent. I have managed to changed the opacity of the map tiles (markers are also transparent but I need to sort that out later).I wanted to add a gradient to the that would look like folds in the page and then have the transparent maps overlaying it so it looks fold lines in a map.

I noticed that google is adding a background color to the div containing the maps... a slight obstical in my plan.

I tried targeting the div with jquery to set the background to none. Unfortunatly for me Google won and I couldn't change it.

$('div div#example').css("background-color","#000");

Here is a fiddle showing how I have things set up http://jsfiddle.net/pTuQ4/


回答1:


There is a map option to change the background color: backgroundColor

For example:

var mapOptions = {
    zoom: 4,
    center: myLatLng,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    backgroundColor: "black"
};


来源:https://stackoverflow.com/questions/11201259/remove-google-maps-background-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!