本文介绍了删除谷歌地图背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使我的Google地图透明.我设法更改了地图图块的不透明度(标记也是透明的,但我以后需要对其进行排序).我想向其添加一个渐变,使其看起来像页面中的褶皱,然后将透明地图覆盖在上面因此它看起来像地图中的折线.

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.

我注意到google为包含地图的div添加了背景颜色...在我的计划中有点过时.

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

我尝试使用jQuery定位div,将背景设置为none.不幸的是,Google赢了,我无法更改.

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");

这是一个小提琴,显示了我如何进行设置 http://jsfiddle.net/pTuQ4/

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

推荐答案

有一个地图选项以更改背景颜色: backgroundColor

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

例如:

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

这篇关于删除谷歌地图背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 21:01