【发布时间】:2014-07-28 03:56:22
【问题描述】:
我正在构建一个使用 Google 的 Mapping API Embed V1.0 的网站,并且我指定的坐标显示正确,但是该点不在映射视图的中心。
问题照片:
iFrame 代码:
<iframe class="sectionMap" width="300" height="300" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?key=AIzaSyAGJVo8xnxXbEICl5IuDAbmWIBsE0cFKVQ&q=42.3599,-71.0655&zoom=18&maptype=satellite"></iframe>
CSS:
.sectionMap{
/*
width: 300px;
height: 300px;
*/
display: block;
position: relative;
left: 50%;
margin-left: -150px;
border-style: solid;
border-width: 2px;
box-shadow: 1px 1px 5px 3px #ccc;
}
这是来自网络应用程序的示例页面:
<section id="williamMonroeTrotterHouse" data-role="page" data-theme="a">
<header data-role="header" data-position="fixed" data-id="appHeader"><a href="#landmarks" data-transition="slide" data-direction="reverse" data-icon="arrow-l" data-rel="back" data-theme="a">Back</a>
<h1>William Monroe Trotter House</h1>
</header>
<div data-role="content">
<p><span class="sectionTitle">Location: </span>97 Sawyer Ave., Dorchester</p>
<p><span class="sectionTitle">Description: </span>Home of African-American journalist and Harvard graduate William Monroe Trotter. Trotter publisher The Guardian, and meetings of African-American activists, W. E. B. Du Bois among them, took place at this house.</p>
<img src="Landmark_Photos/WIlliam_Monroe_Trotter_House.jpg" class="sectionPhoto">
<br>
<iframe class="sectionMap" width="300" height="300" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?key=AIzaSyAGJVo8xnxXbEICl5IuDAbmWIBsE0cFKVQ&q=42.3127,-71.0624&zoom=18&maptype=satellite"></iframe>
</div>
</section>
任何想法为什么这不是居中?
PS:我不认为这是一个重复的帖子,因为 Google 最近更新了映射 API,并且之前问题的答案不起作用。
【问题讨论】:
-
什么设置 iframe 的大小?
-
感谢您的回复:宽度:300px;高度:250px;
-
看不到假定的“兴趣点”在哪里。左上角?
-
这很奇怪。在 JS Fiddle 上,它显示在中间,但在 Safari 上却不是。这会不会与 JQuery Mobile 冲突?
标签: html css google-maps iframe