Google maps 如何将Google地图样式器与jquery ui地图插件一起使用?
我写js的能力太弱了。我需要建立和自定义一个谷歌地图。为此,我使用jquery ui映射插件和以下代码:Google maps 如何将Google地图样式器与jquery ui地图插件一起使用?,google-maps,google-maps-api-3,jquery-ui-map,Google Maps,Google Maps Api 3,Jquery Ui Map,我写js的能力太弱了。我需要建立和自定义一个谷歌地图。为此,我使用jquery ui映射插件和以下代码: if ($("#map_canvas").length){ $('#map_canvas').gmap().bind('init', function(ev, map) { $("[data-gmapping]").each(function(i,el) { var data = $(el).data('gmapping'); $('#map_canv
if ($("#map_canvas").length){
$('#map_canvas').gmap().bind('init', function(ev, map) {
$("[data-gmapping]").each(function(i,el) {
var data = $(el).data('gmapping');
$('#map_canvas').gmap('addMarker', {'id': data.id, 'tags':data.tags, 'position': new google.maps.LatLng(data.latlng.lat, data.latlng.lng), 'bounds':true }, function(map,marker) {
$(el).click(function() {
$(marker).triggerEvent('click');
});
}).click(function() {
$('#map_canvas').gmap('openInfoWindow', { 'content': $(el).find('.info-box').html() }, this);
});
});
});
}
我必须将生成的变量放入何处:
{ stylers: [ { lightness: 7 }, { saturation: -100 } ] }
我使用的链接:
http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html有很多地方可以放置它,例如地图的实例化: 现在: 然后: gmap构造函数接受
google.maps.Map.setOptions()接受的所有选项。其中一个选项是“style”,它应该是一个带有google.maps.maptypetyle
的数组(生成的输出是一个maptypetyle)
$('#map_canvas').gmap() //...more code
$('#map_canvas').gmap({styles:[{stylers:[{lightness:7},{saturation:-100}]}]}) //...more code