无法隐藏我网站地图下的“如何嵌入谷歌地图”链接

时间:2017-04-12 08:12:26

标签: javascript html google-maps google-maps-api-3

我无法在我网站的地图下隐藏“如何嵌入谷歌地图”链接。

<script src='https://maps.googleapis.com/maps/api/js?v=3.exp&key=AIzaSyD0kdWVIPpFGdRWTTakMpe-GFsgOXnr0JQ'></script>
<div style='overflow:hidden;height:400px;width:100%;'>
   <div id='gmap_canvas' style='height:400px;width:100%;'></div
       <style>#gmap_canvas img{max-width:none!important;background:none!important}</style>
</div>
<a href='https://www.embed-map.net/'>how to embed google map</a> <script type='text/javascript' src='https://embedmaps.com/google-maps-authorization/script.js?id=b9034e5a46df59aa59d9407a13d18c82efa4b408'></script><script type='text/javascript'>
function init_map() {
    var myOptions = {
        zoom: 15,
        center: new google.maps.LatLng(42.657185, 23.364427699999965),
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById('gmap_canvas'), myOptions);
    marker = new google.maps.Marker({
        map: map,
        position: new google.maps.LatLng(42.657185, 23.364427699999965)
    });
    infowindow = new google.maps.InfoWindow({
        content: '<strong>Авантюрин</strong><br>Илия Димушев<br>1756 Sofia<br>'
    });
    google.maps.event.addListener(marker, 'click', function() {
        infowindow.open(map, marker);
    });
    infowindow.open(map, marker);
}
google.maps.event.addDomListener(window, 'load', init_map);

我试图删除这个元素:

 <a href='https://www.embed-map.net/'>how to embed google map</a>

试图用display:none隐藏它;但它隐藏了整个地图。有任何想法如何删除?

1 个答案:

答案 0 :(得分:0)

试用此代码:

<script src='https://maps.googleapis.com/maps/api/js?v=3.exp&key=AIzaSyD0kdWVIPpFGdRWTTakMpe-GFsgOXnr0JQ'></script><div style='overflow:hidden;height:400px;width:100%;'><div id='gmap_canvas' style='height:400px;width:100%;'></div><style>#gmap_canvas img{max-width:none!important;background:none!important}</style></div> <script type='text/javascript' src='https://embedmaps.com/google-maps-authorization/script.js?id=b9034e5a46df59aa59d9407a13d18c82efa4b408'></script><script type='text/javascript'>function init_map(){var myOptions = {zoom:15,center:new google.maps.LatLng(42.657185,23.364427699999965),mapTypeId: google.maps.MapTypeId.ROADMAP};map = new google.maps.Map(document.getElementById('gmap_canvas'), myOptions);marker = new google.maps.Marker({map: map,position: new google.maps.LatLng(42.657185,23.364427699999965)});infowindow = new google.maps.InfoWindow({content:'<strong>Авантюрин</strong><br>Илия Димушев<br>1756 Sofia<br>'});google.maps.event.addListener(marker, 'click', function(){infowindow.open(map,marker);});infowindow.open(map,marker);}google.maps.event.addDomListener(window, 'load', init_map);
</script>