gpt4 book ai didi

jquery - 如何使用 jQuery Mobile 显示全屏谷歌地图?

转载 作者:行者123 更新时间:2023-12-03 22:35:04 25 4
gpt4 key购买 nike

以下代码显示奇怪的输出。我应该看到全屏移动 map 。但由于某种原因,它仅显示在屏幕的一部分上。我正在使用 jquery.ui.map 进行映射。

<!DOCTYPE html> 
<html>
<head>
<title>My Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jquery.mobile-1.1.0.min.css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script src="js/jquery-1.7.1.min.js"></script>
<script src="js/jquery.mobile-1.1.0.min.js"></script>
<script type="text/javascript" src="js/jquery.ui.map.min.js"></script>
</head>
<body>

<div data-role="page">

<div data-role="header">
<h1>My Title</h1>
</div><!-- /header -->

<div data-role="content" id="map_canvas" name="contentMain">

</div><!-- /content -->

</div><!-- /page -->
<script>

$('#map_canvas').gmap().bind('init', function() {
// This URL won't work on your localhost, so you need to change it
// see http://en.wikipedia.org/wiki/Same_origin_policy
$.getJSON( 'http://jquery-ui-map.googlecode.com/svn/trunk/demos/json/demo.json', function(data) {
$.each( data.markers, function(i, marker) {
$('#map_canvas').gmap('addMarker', {
'position': new google.maps.LatLng(marker.latitude, marker.longitude),
'bounds': true
}).click(function() {
$('#map_canvas').gmap('openInfoWindow', { 'content': marker.content }, this);
});
});
});
});
</script>
</body>
</html>

输出:

enter image description here

提前致谢。

最佳答案

我的移动网站的解决方案是设置样式 position:absolute;宽度:100%; height:100%; 对于 Canvas div。您可以使用 topbottom 样式为工具栏留出空间。

关于jquery - 如何使用 jQuery Mobile 显示全屏谷歌地图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10406252/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com