Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
谷歌地图Javascript部分导致文本变为粗体_Javascript_Html_Google Maps - Fatal编程技术网

谷歌地图Javascript部分导致文本变为粗体

谷歌地图Javascript部分导致文本变为粗体,javascript,html,google-maps,Javascript,Html,Google Maps,以下是影响它的代码: <script type="text/javascript"> function initialize() { var latLng = new google.maps.LatLng(51.4893169, -2.1182648); var mapOptions = { center: latLng, zoom: 15, scrollwheel: false, };

以下是影响它的代码:

<script type="text/javascript">
    function initialize() {
      var latLng = new google.maps.LatLng(51.4893169, -2.1182648);
      var mapOptions = {
        center: latLng,
        zoom: 15,
        scrollwheel: false,
      };
      var map = new google.maps.Map(document.getElementById('map-canvas'),
        mapOptions);
      var image = 'images/map_blue.png';
      var marker = new google.maps.Marker({
        position: latLng,
        map: map,
        icon: image
      });
    }
    google.maps.event.addDomListener(window, 'load', initialize);
  </script>

函数初始化(){
var latLng=新的google.maps.latLng(51.4893169,-2.1182648);
变量映射选项={
中心:拉特林,
缩放:15,
滚轮:错误,
};
var map=new google.maps.map(document.getElementById('map-canvas'),
地图选项);
var image='images/map_blue.png';
var marker=new google.maps.marker({
位置:latLng,
地图:地图,
图标:图像
});
}
google.maps.event.addDomListener(窗口“加载”,初始化);
它使我的一些文本变为粗体,在Google inspect元素中没有显示粗体或字体重量。。但是,如果我删除了上述代码^

这让我很困惑,因为我看不出这两者之间有什么联系。。我检查了我的html中缺少的字符,但它是完美的(在网站上也验证过)


啦啦队队员们也有同样的问题,原因是页面使用了字体“Roboto”,字体重量为300,但谷歌地图加载的字体重量为300400500700,所以“普通”eq 400,而不是300,文本变得更粗体

您的java脚本是准确的。一定还有另外一个原因。当我移除它时,它会对它产生什么影响?我有其他几页几乎相同,没有这个问题。。此外,页面最初加载良好,加载约0.2秒后字体切换为粗体。问得好。你能把你的html等添加到提琴上让我们看看吗?在Chrome中,检查粗体元素。然后打开“计算”选项卡并搜索字体大小。单击左侧的Triagle可查看其继承位置。Inspector将告诉您该样式是来自CSS,还是继承自
strong
h1
父标记。当您加载地图时,“地图”API会在页面中注入一些CSS,可能该CSS会影响您的文档(如果不看到页面的HTML,很难给出更详细的答案)真棒,谢谢-这让我困惑了一段时间!如何防止这种情况发生?字体重量:300;你真棒!