0
Gmaps APIV3接受我的x
變量,但拒絕我的weight
變量,儘管兩者都是數字。這裏發生了什麼?SetOptions接受一個數字變量,拒絕另一個數字變量
google.maps.event.addListener(map, 'zoom_changed', function() {
var zoomLevel = map.getZoom(); //something between 18-12
var weight = zoomLevel - 5;
var x = 3;
console.log(typeof(x)); // number
console.log(typeof(weight)); //number
$.each(paths, function(i, path){
path.setOptions({strokeWeight: x}); //works
// path.setOptions({strokeWeight: weight}); //doesn't work
})
});
添加JavaScript作爲一個標籤,因爲我不能確定是否這是嚴格Gmaps相關或語言的事情,我不知道的。刪除它,如果我錯了。