簡體   English   中英

Google Maps JS APi v3融合表層無法在Chrome中運行

[英]Google Maps JS APi v3 fusion table layer is not working in Chrome

我通過融合表層功能設置了一個帶有國家覆蓋的谷歌地圖。

在這里工作得很好: http//codepen.io/anon/pen/ZYLPNO

 function loadMap() { var script = document.createElement('script'); script.type = 'text/javascript'; //script.src = 'http://maps.googleapis.com/maps/api/js?v=3.exp&key=' + settings.api_key + '&' + 'callback=initMap'; script.src = 'http://maps.googleapis.com/maps/api/js?v=3.exp' + '&' + 'callback=initMap'; document.body.appendChild(script); } initMap = function() { var google = window.google || {}; var c_map = new google.maps.Map(document.getElementById('map-canvas'), { center: new google.maps.LatLng(30,0), zoom: 2, disableDefaultUI: true, mapTypeId: google.maps.MapTypeId.ROADMAP }); var world_geometry = new google.maps.FusionTablesLayer({ query: { select: 'geometry', from: '1N2LBk4JHwWpOY4d9fobIn27lfnZ5MDy-NoqqRpk', where: "Name IN ('Russia','France')" }, styles: [{ where: "Name = 'France'", markerOptions: { iconName: 'red_circle' }, polygonOptions: { fillColor: '#EB6841', fillOpacity: 0.3 } }, { where: "Name = 'Russia'", polygonOptions: { fillColor: '#00A0B0', fillOpacity: 0.5 } }], map: c_map, suppressInfoWindows: true }); google.maps.event.addListener(world_geometry, 'click', function(e) { document.location.href = document.location.protocol + '//' + document.location.host + '/countries/' + e.row.Name.value.toLowerCase(); }); }; loadMap(); 
 #map-canvas, html, body { height: 200px; width: 300px; color: #000; font-family: 'Open Sans', sans-serif; z-index: 2; box-sizing: border-box; word-wrap: break-word; font-size: 20px; font-style: normal; font-weight: normal; height: 300px; line-height: 30px; box-shadow: 0px 3px 5px 0 #333 } 
 <div id="map-canvas"></div> 

但是嵌入我網站的相同代碼在Firefox(windows,mac,android),Safari(iOS,Mac),IE11(Windows)中工作但不適用於Chrome(Mac,Windows,Android)。

沒有javascript錯誤,地圖只顯示沒有疊加。 我甚至試圖刪除我的頁面上的所有js,除了這個。 我也完全按照它們在我的網站上復制樣式(正如你在codepen中看到的那樣)。

不幸的是我不能給你一個鏈接到我的網站,它現在托管在我的筆記本電腦上。

任何想法如何調試這個?

這是一個CSS問題,由此規則強制(在style.cab.css中):

img{max-width:100%;}

添加此規則:

 #map-canvas img{max-width:none;}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM