简体   繁体   中英

How to show map marker in Google Maps API using JavaScript

How to show map marker in Google Maps API using JavaScript?

How to search specific area with display around location? How to show with dotted lines?

I'm not gonna do the whole job for you, but please have a look at gmap3 . A jQuery plugin that lets you handle Google Maps in a very easy way.

Include the source file and then just to get started, create a div:

<div id="map"></div>

Then, in jQuery, run:

$("#map").gmap3();

This should generate a Google Map with no specific coordinates. If you want to get more complex, you can read all about that at http://gmap3.net/en/catalog/ , but here's an example.

$('#map').gmap3({
 marker:{
    latLng:[29.132318972825445,81.32052349999992]
 }
});

This puts out a pin at a certain coordinate. They have a clear documentation, so just head over there and follow their instructions. Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM