wzr*_*337 5 jquery jquery-ui google-maps-api-3 jquery-ui-map
我使用以下代码通过使用jquery,jqueryui-map和google maps API向地图添加形状
$('#map_canvas').gmap('getCurrentPosition', function(position, status) {
if ( status === 'OK' ) {
var clientPosition = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
$('#map_canvas').gmap('addMarker', {'position': clientPosition, 'bounds': false});
$("#map_canvas").gmap("option", "center", clientPosition);
$('#map_canvas').gmap('option', 'zoom', 14);
$('#map_canvas').gmap('addShape', 'Circle', {
'strokeColor': "#008595",
'strokeOpacity': 0.8,
'strokeWeight': 2,
'fillColor': "#008595",
'fillOpacity': 0.35,
'center': clientPosition,
'radius': 50,
'clickable': false });
}
});
Run Code Online (Sandbox Code Playgroud)
我还尝试在$('#map_canvas')上调用.addShape方法.但我只得到以下错误:
Uncaught TypeError: Cannot call method 'apply' of undefined jquery.ui.map.js:46
$.a.$.fn.(anonymous function) jquery.ui.map.js:46
e.extend.each jquery.min.js:2
e.fn.e.each jquery.min.js:2
$.a.$.fn.(anonymous function) jquery.ui.map.js:40
(anonymous function) :8080:397
$.extend.getCurrentPosition
Run Code Online (Sandbox Code Playgroud)
有谁知道如何解决这个问题?http://jquery-ui-map.googlecode.com/svn/trunk/demos/jquery-google-maps-geolocation.html上的示例由于某种原因而起作用.我只是无法弄清楚实际的差异.也许我现在要失明了;)
谢谢,
拍
有同样的问题,从相同的文档产生,没有提到包括 jquery.ui.map.overlays.js
代码说
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="PATH_TO_PLUGIN/jquery.ui.map.js"></script>
<script type="text/javascript" src="PATH_TO_PLUGIN/jquery.ui.map.extensions.js"></script>
Run Code Online (Sandbox Code Playgroud)
实际上你需要的时候
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="PATH_TO_PLUGIN/jquery.ui.map.js"></script>
<script type="text/javascript" src="PATH_TO_PLUGIN/jquery.ui.map.overlays.js"></script>
Run Code Online (Sandbox Code Playgroud)
事实上,经过测试,它没有 jquery.ui.map.extensions.js
| 归档时间: |
|
| 查看次数: |
2807 次 |
| 最近记录: |