dp6319 2013-02-12 20:55
浏览 90
已采纳

奇怪的Google地图行为:弹出框和缩放栏无法正确显示

First off I think a picture shows my issue best:

enter image description here

In the picture you can see how the pop up box on my balloons are a mess, and the zoom bar to the left is also hardly there.

I have php generating my map code, and my code looks like this:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.3&amp;sensor=false"></script>
                    <div class="span9 space"><div id="map" style="width: 600px; height: 400px;"></div><script type="text/javascript">
    var locations = [['21st Amendment Brewery', 37.7824175, -122.3925921] ,['Allagash Brewing Company', 43.702697, -70.317975] ,['Anheuser-Busch', 38.5986606, -90.208751] ,['Ayinger Brewery', , ] ,['Bass Brewery', 52.8045853, -1.6281372] ,['Bear Republic Brewery', 38.6040452, -122.8599961] ,['Boston Beer Company', 42.314449, -71.103365] ,['Boulevard Brewing Company', 39.0821348, -94.5966532] ,['Brasserie des Franches-Montagnes', 47.2542808, 7.0025782] ,['Breckenridge Brewery', 39.723597, -105.000614] ,['Brewery Ommegang', 42.6818046, -74.9254739] ,['Brooklyn Brewery', 40.721535, -73.95745] ,['Brouwerij Artois', 50.8870692, 4.7025108] ,['Brouwerij Huyghe', 50.99832, 3.79404] ,['Buffalo Bills Brewery', 37.6738157, -122.0813029] ,['Butternuts Beer and Ale', 42.6290648, -75.1854868] ,['Caldera Brewing', 42.184409, -122.663147] ,['Cervecera Cuauhtmoc-Moctezuma', 25.6375417, -100.2946801] ,['Clipper City Brewing Company', 39.230827, -76.6751309] ,['Coors Brewing Company', 39.759876, -105.219026] ,['Cricket Hill Brewing Company', 40.872566, -74.296359] ,['D.G. Yuengling and Son', 40.6999592, -76.1747169] ,['Dogfish Head Craft Brewery', 38.770622, -75.310893] ,['DuClaw Brewing Company', 39.496656, -76.329843] ,['Erie Brewing Company', 42.111185, -80.112978] ,['Evolution Craft Brewing Company', 38.4622609, -75.5741469] ,['Firestone Walker Brewing Company', 35.595325, -120.693728] ,['Flying Dog Brewery', 39.361926, -77.424677] ,['Fordham Brewing Company', 39.1540034, -75.4883626] ,['Founders Brewing Company', 42.958468, -85.673516] ,['Fulton Brewing Company', 44.9849423, -93.2790206] ,['Goose Island Beer Company', 41.887107, -87.6720969] ,['Gordon Biersch Brewing', 37.354139, -121.89286] ,['Great Divide Brewing Company', 39.753646, -104.9884698] ,['Green Flash Brewing Company', 32.905722, -117.176517] ,['Grupo Modelo S.A. de C.V.', 19.422447, -99.209758] ,['Guinness', 53.34309, -6.290799] ,['Harpoon Brewery', 43.512997, -72.401527] ,['Heavy Seas', 39.230827, -76.6751309] ,['Heineken International', , ] ,['Hoppin Frog Brewery', 41.0245928, -81.4677107] ,['Jacob Leinenkugel Brewing Company', 44.943321, -91.3953049] ,['Lagunitas Brewing Company', 38.272435, -122.662346] ,['Magic Hat Brewing Company', 44.428405, -73.213148] ,['Maui Brewing Company', 20.972149, -156.677334] ,['Mendocino Brewing Company', 38.9734335, -123.1162429] ,['MillerCoors Brewing Company', 43.044464, -87.962562] ,['Narragansett Brewing Company', 41.8190249, -71.4097368] ,['New Belgium Brewing', 40.593415, -105.066874] ,['North Coast Brewing Company', 39.446471, -123.806238] ,['Old Dominion Brewing Company', 39.1540034, -75.4883626] ,['Oskar Blues Brewery', 40.139056, -105.121887] ,['Pabst Brewing Company', 29.4497864, -98.5386319] ,['Port Brewing Company', 33.141417, -117.150076] ,['Port City Brewing Company', 38.8081958, -77.1014693] ,['RJ Rockers Brewing Company', 34.948639, -81.935726] ,['Rock Art Brewery', 44.557791, -72.608085] ,['Rogue Ales', 44.620173, -124.0520565] ,['Schneider Weisse', 48.91755, 11.87451] ,['Scottish & Newcastle Breweries', 55.954155, -3.202774] ,['Shipyard Brewing', 43.6618784, -70.2489402] ,['Sierra Nevada Brewing Company', 39.7246028, -121.8157154] ,['Sixpoint Craft Ales', 40.6739317, -74.0119473] ,['Sleeman Breweries Ltd.', 43.4870365, -80.2067709] ,['Smuttynose Brewing Co.', 43.032502, -70.7947688] ,['Southern Tier Brewing Company', 42.088931, -79.350342] ,['Spaten-Franziskaner-Bräu', 48.14501, 11.55419] ,['Staatliches Hofbräuhaus (Hofbräu München)', 48.1373073, 11.580357] ,['Stone Brewing Company', 33.115682, -117.119552] ,['Stoudts Brewery', 40.2422441, -76.0540026] ,['Surly Brewing Company', 45.04285, -93.324557] ,['The Bronx Brewery', 40.80828, -73.930669] ,['The Duck-Rabbit Craft Brewery', 35.600267, -77.597058] ,['The Lost Abbey', 33.141417, -117.150076] ,['The Saint Louis Brewery', 38.632968, -90.209769] ,['Tröegs Brewing Company', 40.304, -76.643519] ,['Unibroue', 45.466125, -73.290924] ,['Union Craft Brewing Company', 39.331938, -76.641971] ,['Victory Brewing Company', 40.0061038, -75.6941546] ,['Wells and Young&#39;s Brewing Company', 52.132011, -0.481523] ,['Weyerbacher Brewing Company', 40.673181, -75.224926] ,['Widmer Brothers Brewing', 45.540795, -122.675594] ,['Yards Brewing Company', 39.962616, -75.136253]  

        ];

    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 10,
      center: new google.maps.LatLng(-33.92, 151.25),
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });


        var bounds = new google.maps.LatLngBounds();
    var infowindow = new google.maps.InfoWindow();

    var marker, i;

    for (i = 0; i < locations.length; i++) {
        var position = new google.maps.LatLng(locations[i][1], locations[i][2]);  
      marker = new google.maps.Marker({
        position: position,
        map: map
      });



      google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
          infowindow.setContent(locations[i][0]);
          infowindow.open(map, marker);
        }
      })(marker, i));

      bounds.extend(position);

    } //end for loop


    map.fitBounds(bounds);


  </script>

Also you can see I am getting this error message in the chrome console:

Resource interpreted as Image but transferred with MIME type text/html:

I ran into this problem when trying to update my website and bring it into a new template and css I am using. I am using the same function call in both website to produce my map, so I do not understand why its broken on one site and not the other.

  • 写回答

2条回答 默认 最新

  • duanjian4331 2013-02-12 20:58
    关注

    it has to do with the css styling of img

    Bootstrap has a specific style on the img element that messes up Google Maps Image's

    Find the style img in your stylesheets and edit it until this doesn't show up anymore.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题
  • ¥15 github训练的模型参数无法下载
  • ¥15 51单片机显示器问题
  • ¥20 关于#qt#的问题:Qt代码的移植问题
  • ¥50 求图像处理的matlab方案
  • ¥50 winform中使用edge的Kiosk模式
  • ¥15 关于#python#的问题:功能监听网页
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题