我已经开始使用地理定位,我可以获得坐标等。我想在地图中显示它,但是当我将地图返回到 div 时,什么都没有显示。现在我查看了 div,地图正在返回,但不可见。这是有问题的 div
请注意,这似乎只是一个小地图的链接
<a style="position: static; overflow-x: visible; overflow-y: visible; float: none; display: inline; " target="_blank" href="http://maps.google.com/maps?ll=51.263519,-7.124185&z=21&t=m&hl=en-US" title="Click to see this area on Google Maps"><div style="width: 62px; height: 24px; cursor: pointer; "><img style="position: absolute; left: 0px; top: 0px; -webkit-user-select: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; width: 62px; height: 24px; " src="http://maps.gstatic.com/mapfiles/google_white.png" draggable="false"></div></a>
这就是我正在做的,Html Home
你的地点
<div data-role="content" id="location1">
<div id="map" style="width:100%; height:100%"></div>
我的模型如下
bb.model.Map = Backbone.Model.extend({
defaults: {
center: new google.maps.LatLng(51.26351898,-6.14462727),
zoom: 20,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
});
我的看法如下
bb.view.Location = Backbone.View.extend(_.extend({
id: 'map',
initialize: function(){
this.map = new google.maps.Map(this.el, this.model.attributes);
this.render();
},
render: function(){
// $('#map').replaceWith(this.el);
$('#map').replaceWith(this.el);
$('#location-page').page();
},
}))
我也在使用以下脚本。
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>