Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.1k views
in Technique[技术] by (71.8m points)

iframe - Google Maps Embed - Remove Place Card

I'm using the new Google maps embed code (iFrame) to add a small map to my website, but I can't hide the new address box in the top left corner (see image below).

http://i.imgur.com/JOVXkra.jpg

I have generated the map code by clicking the "Share and embed map" option (see image below), but I'm wondering if I need to use the full API to achieve this.

http://i.imgur.com/xxl25Ga.png

All of the resources I've found so far just discuss the old embedding version and disabling the information balloon which is not the same, and the only clue I've got is that the HTML class of the box is called "place-card" but searching is still bringing me nothing.

Any help or point in the right direction would be much appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can hide all buttons with css. Create a container div width overflow on hidden and the sizes you need. Place the new google maps iframe/embed inside with a largersize. To position the maps iframe use negative marges..

Example with 100% width:

<div style="width: 100%; overflow: hidden; height: 300px;">
  <iframe 
     src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d39797.07748547086!2d5.46683904751879!3d51.433965676849986!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47c6d90575ca5e3d%3A0x55989f5f344b006!2sPrins+Hendrikstraat+5!5e0!3m2!1snl!2snl!4v1392716144537"
     width="100%"
     height="600"
     frameborder="0"
     style="border:0; margin-top: -150px;">
  </iframe>
</div>

Make the iframe 300px higher than your container div. 150px to hide below and 150px to hide on top. To hide this 150 on the top of the iframe use:

margin-top: -150px;


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...