Google Map ApiðµÄݽ(¢ÅÉjQueryÌvOC»)
æúAGoogle Mapðp·é@ïª Á½ÌÅ·ªAÅÍPÉn}ª ê΢¢Æ¢¤±Æ¾¯¾Á½æ¤ÈÌÅAGoogle MapÌAPIÆ©ðp¹¸ÉAn}ÌEãÉ éNÌì¬ÅÅÄéiflameð\¦³¹æ¤ÆvÁÄ¢½B
µ©µAAPIÌpû@ÁÄǤ¾Á½©È[HÈñÄvÁ½ÌÅAÈOpµ½±Æª Á½ÌÅ·ªAÄx²×ÄÝé±ÆÉB
¡Ío[WªRàoÄ¢éÌÅ·ªA»êÍpµ½±ÆªÈ©Á½ÌÅA»êÌpû@Å·B
Google Map APIÌp
o[WR©çÍAPIL[ªsvÆ̱ÆBpªyÉÈÁÄÜ·ËB
ܸÍMapðp·é½ßÌCuÌÇÝÝ
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false"></script>
ÅãÌsensorªK{Æ̱ÆÅAGPSÌæ¤ÈÊuZT[p·éàÌÅAiPhoneÈÇÌoCfoCXÅÌpª éÈçtrueðA»¤ÅȯÎfalseðüêĨÆ̱ÆB
üêĢȢÆG[ªÅéB
î{IÈJavaScript
window.onliad = gmap();
function gmap() {
var mapdiv = document.getElementById('map');
var myOptions = {
zoom: l(0`19),
center: new google.maps.LatLng(Üx, ox),
mapTypeId: google.maps.MapTypeId.ROADMAP,
scaleControl: true,
};
var map = new google.maps.Map(mapdiv, myOptions);
});
\¦³¹½¢ÓÌIDÌwèÆA\¦ÊuÌÜxÆoxÌwèA\¦{¦Ìw辯Ţ¢ñÅ·ËBãÍ\¦ÊuÌubNÉƳðCSSÈÇůĨÆB
ÈOÌAPIL[ðüêÈ¢Æg¦È¢æèàVvÉg¢ÀÈÁÄ¢éݽ¢Å·ËB
}[J[Æ«oµ
}[J[Æ«oµðÁ¦éêÍAæÙÇÌàeÉÌàeðÁ¦é¾¯B
¡}[J[
var marker = new google.maps.Marker({
position: new google.maps.LatLng(Üx, ox),
map: map,
title: '}[J[Ì^Cg'
});
n}ãÅÌÊuð¦·}[J[ª\¦³êéæ¤ÉÈèÜ·B
¡«oµ
var infowindow = new google.maps.InfoWindow({
content: 'îñEBhEàÉ\¦·éHTML',
size: new google.maps.Size(, ³)
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
jQueryÌvOCɵÄݽ
ãḺÆÆ©ðñpû@ðl¦Ä¢éÌàåÏÅ·µAÅßÍjQueryg¤ÄΩèÈÌÅAjQueryÌvOCɵÄÝܵ½BVv߬éÌÅ·ªAn}ð\¦³¹é¾¯`ÈñÄÉÍÖ©ÈÆB
pluginÌg
$.fn.gmap = function(latitude,longitude,set) {
var set = $.extend({
zoom: 15
}, set)
var mapdiv = $(this).get(0);
var myOptions = {
zoom: set.zoom,
center: new google.maps.LatLng(latitude,longitude),
mapTypeId: google.maps.MapTypeId.ROADMAP,
scaleControl: true,
};
var map = new google.maps.Map(mapdiv, myOptions);
};
pû@
ܸÍMapðp·é½ßÌCuÆjQueryðÇÝÝA¿åÁƵ½LqðÁ¦é¾¯¥¥¥Æ¢¤VvÈàÌB}[J[¾µ½èA}[J[àÌeLXgwèÅ«½èµ½çàÁÆvOCÁÛÈéÌ©Æàv¤ÌÅ·ªAܸÍn}ð\¦³¹é¾¯ÅB
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="js/jquery.gmap3.js"></script>
<script type="text/javascript">
$(function(){
$('#gmap').gmap(latitude,longitude);
});
</script>
»êÆA\¦³¹é½ßÉAãLÌáÌêÍAid="gmap"Æ¢¤ubNðìèƳðwèµÄ¨¾¯Å·B
¡IvV
æÙÇ̪ðê²BÜxÆoxÌwè̼ÉàAzoomÌIvV¾¯Â¯ÄÝܵ½BIvVªÍÈÄànjBftHgÍ15ÉÈÁĢܷB
$(\¦³¹éê).gmap(Üx,ox,{zoom:l(0`19)});
¡Demo
ºÌfÍu$('#map').gmap(43.068625,141.350801);vð\¦µ½àÌÅ·B
¡DemoQ
»µÄ±¿çÍu$('#map2').gmap(37.912027,139.061883,{zoom:13});vÆA{¦ÌwèàüêÄ èÜ·B
ÍिåÁÆ@\ðâµÄÝ椩ÈBjQueryðgíÈ¢Åàl¦ÄÝ椩ÈB