如何使用jquery-ui-map在谷歌地图上添加标记 [英] How to add marker on google map using jquery-ui-map
本文介绍了如何使用jquery-ui-map在谷歌地图上添加标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 http://code.google.com/p/jquery- ui-map /
HTML:
< div id =map_canvasstyle =width:100%; height:400px; latitude =123456longitude =123456>载入地图< / div>
jQuery :
$ {$ b $ center':new google.maps.LatLng($($ '#map_canvas')。attr('latitude'),$('#map_canvas')。attr('longitude')),
'zoom':13
});
} );
工作正常,但我无法添加标记。我曾在文档中尝试过很多选项,但无法放置标记。
任何想法?
谢谢
解决方案
http://jquery-ui-map.googlecode.com/svn/trunk/demos/jquery-google-maps-basic-example.html
$('#map_canvas')。gmap()。bind('init',function(ev,map ){
$('#map_canvas')。gmap('addMarker',{'position':'57 .7973333,12.0502107','bounds':true})。click(function(){
$ ('#map_canvas')。gmap('openInfoWindow',{'content':'Hello World!'},this);
});
});
I am using http://code.google.com/p/jquery-ui-map/
HTML:
<div id="map_canvas" style="width: 100%; height:400px;" latitude="123456" longitude="123456">Loading Map</div>
jQuery:
$(function() {
$('#map_canvas').gmap({
'center': new google.maps.LatLng($('#map_canvas').attr('latitude'),$('#map_canvas').attr('longitude')),
'zoom': 13
});
});
It is working fine but I am unable to add a marker. I have tried many option in documentation but unable to place marker.
Any Idea?
Thanks
解决方案
http://jquery-ui-map.googlecode.com/svn/trunk/demos/jquery-google-maps-basic-example.html
$('#map_canvas').gmap().bind('init', function(ev, map) {
$('#map_canvas').gmap('addMarker', {'position': '57.7973333,12.0502107', 'bounds': true}).click(function() {
$('#map_canvas').gmap('openInfoWindow', {'content': 'Hello World!'}, this);
});
});
这篇关于如何使用jquery-ui-map在谷歌地图上添加标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文