0

首先,我认为一张图片最能说明我的问题:

在此处输入图像描述

在图片中你可以看到我的气球上的弹出框是多么的乱七八糟,左边的缩放栏也几乎不存在。

我有 php 生成我的地图代码,我的代码如下所示:

<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>

您还可以看到我在 chrome 控制台中收到此错误消息:

资源解释为图像,但使用 MIME 类型 text/html 传输:

我在尝试更新我的网站并将其引入我正在使用的新模板和 css 时遇到了这个问题。我在两个网站上都使用相同的函数调用来生成我的地图,所以我不明白为什么它在一个站点上而不是另一个站点上坏了。

4

2 回答 2

1

它与 css 样式有关img

Bootstrap 在元素上有一个特定的样式,img它弄乱了 Google Maps Image 的

在您的样式表中找到该img样式并对其进行编辑,直到它不再出现为止。

于 2013-02-12T20:58:09.487 回答
0

感谢@RPM 的评论,我被指出了研究什么的正确方向。我在这个线程上找到了我的答案:

Twitter Bootstrap CSS 影响谷歌地图

谢谢转!

于 2013-02-12T21:11:44.900 回答