开发者

Google Maps JQuery Plugin Problem

开发者 https://www.devze.com 2022-12-09 01:40 出处:网络
Has anyone been able to get this to work? http://code.google.com/p/jquery-googlemap/ I only seem to get it to work if in debug:true, even then nothing appears like directions.

Has anyone been able to get this to work?

http://code.google.com/p/jquery-googlemap/

I only seem to get it to work if in debug:true, even then nothing appears like directions.

I am looking for a way either in PHP or jquery to set the address and have the map set it dy开发者_如何学运维namically, as it's one page with the address of many places loaded with php. So the address changes every time.


That project is no longer maintained. If I were you I would go with more stable projects such as jQuery UI and Mobile Google Maps v3 plugin.


I got it to work. First you need to get your own googlemap key from here.

Then you need to download the googlemap.js source. I got a copy from here.

Then you need to include the following references:

<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=PutYourKeyHere"></script>
<script type="text/javascript" src="~/Scripts/googlemaps.js"></script>

<script type="text/javascript">
    jQuery(function($) {
        $("#map").googlemap({ addresses: ["1 ABC ST, NSW 2193 Sydney, Australia"] });
    });
</script>

And put a div in

<div id="map" style="width: 500px; height: 300px"></div>

Note: this plug-in seems to require an id not a class. For example if I define my div to have class="map" instead, $('.map').googlemap() fails with a null reference.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号