开发者

Get Map Object in Javascript after using CodeIgniter Google Maps API

I'm using th开发者_Python百科e codeigniter library for the google maps api. I load the map using the library located on the CI Wiki: http://www.phpinsider.com/php/code/GoogleMapAPI/

I want to then use javascript on the map object after loading the page. How can I get the map object in javascript? Can I use GMap2 on the same div? Won't that recreate the map?

The reason I want to do this is to bind an event to the map.

Thanks!


Hope this works:

var myMap;

function getMap()
{

if(myMap == null)

    myMap = new GMap2(document.getElementById("map"));

    return myMap;

}

and then refer to this function to get reference to the GMap2 object.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜