Jquery 从head中删除Google Map V3附加样式和链接

Jquery 从head中删除Google Map V3附加样式和链接,jquery,google-maps-api-3,cmsmadesimple,Jquery,Google Maps Api 3,Cmsmadesimple,我在CMS Make Simple 1.11.11中工作,通常情况下,这就是我的在大多数页面上的外观 <head> <base href="http://np.dev/"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width,

我在CMS Make Simple 1.11.11中工作,通常情况下,这就是我的
在大多数页面上的外观

<head>
<base href="http://np.dev/">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, user-scalable=no">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="language" content="en_US">
<meta name="url" content="http://np.dev">
<meta name="identifier-URL" content="http://np.dev">
<meta name="revised" content="Sun, 19 Oct 2014 23:00:50">    
<title>My localhost demo site</title>
<link rel="stylesheet" type="text/css" href="http://np.dev/tmp/cache/stylesheet_combined_b494846cba46cad77e309f4df2e3bfe7.css">
<link rel="stylesheet" type="text/css" href="http://np.dev/tmp/cache/stylesheet_combined_d3f3ceb94300bf27c9a51ce2e1404348.css">
...
</head>

我的本地主机演示站点
...
上面的布局很好。但是,如果我在这个模板上附加并运行Google Maps v3 API,Google Maps将在
元素前面添加一些
制作以下

   <head>
   /*I WANT TO USE JQUERY TO REMOVE THESE 5 ELEMENTS WHEN THE WINDOW IS READY*/
   <style type="text/css">.gm-style .gm-style-mtc label,.gm-style .gm-style-mtc div{font-weight:400 </style>
   <style type="text/css">.gm-style .gm-style-cc span,.gm-style .gm-style-cc a,.gm-style .gm-style-mtc div{font-size:10px}</style>
   <link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
   <style type="text/css">@media print {  .gm-style .gmnoprint, .gmnoprint {    display:none  }}@media screen {  .gm-style .gmnoscreen, .gmnoscreen {    display:none  }}</style>
   <style type="text/css">.gm-style{font-family:Roboto,Arial,sans-serif;font-size:11px;font-weight:400;text-decoration:none}</style>

    <base href="http://np.dev/">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="language" content="en_US">
    <meta name="url" content="http://np.dev">
    <meta name="identifier-URL" content="http://np.dev">
    <meta name="revised" content="Sun, 19 Oct 2014 23:00:50">    
    <title>My localhost demo site</title>
    <link rel="stylesheet" type="text/css" href="http://np.dev/tmp/cache/stylesheet_combined_b494846cba46cad77e309f4df2e3bfe7.css">
    <link rel="stylesheet" type="text/css" href="http://np.dev/tmp/cache/stylesheet_combined_d3f3ceb94300bf27c9a51ce2e1404348.css">
    ...
    </head>

/*我想在窗口准备就绪时使用JQUERY删除这5个元素*/
.gm style.gm style mtc标签.gm style.gm style mtc div{font-weight:400
.gm style.gm style cc span、.gm style.gm style cc a、.gm style.gm style mtc div{font size:10px}
@媒体打印{.gm style.gmnoprint.gmnoprint{display:none}}@media screen{.gm style.gmnoscreen.gmnoscreen{display:none}
.gm样式{字体系列:Roboto,Arial,无衬线;字体大小:11px;字体重量:400;文本装饰:无}
我的本地主机演示站点
...

我认为“预防”是不可能的从Google Maps API加载到DOM中的前5个子元素,所以我想做下一件最好的事情…我想在窗口准备好后使用jQuery从
中删除这些元素。这可能吗?

删除所有头
样式
链接
元素,这种方式可以按照您的方式工作n除此之外,添加一个
lt()
选择器会将选择限制为每种类型的前n个


覆盖谷歌设置的属性可能是一个更易于维护的解决方案。

问题:我的网站表现得很奇怪,所有字体都是粗体的,我发现上面有不需要的样式表

解决方案:我在css文件中使用了以下代码行,并删除了以下代码行:

@import url('https://fonts.googleapis.com/css?family=Open+Sans');

在样式表中覆盖那些CSS属性,让它们继承默认值怎么样?作为最后的手段,我会这么做-但一开始我想在DOM准备好并且没有东西放在我的基本元素上时,使用“更干净”的外观…您可以添加一个:lt()选择器,以便准确地删除前4个s和第一个元素;我已更新了上述代码。如果Google Maps更改添加的标记数,或者如果任何其他脚本在Google标记之前添加了任何附加的/,则可能会出现问题。我必须做一点小小的调整。我改为设置lt(2)样式,然后链接lt(1),然后设置lt(2)样式。谢谢!我也看到这是有效的…$('base')。prevAll().remove();
@import url('https://fonts.googleapis.com/css?family=Open+Sans');