http://stackoverflow.com/questions/12601907/loading-google-maps-in-anonymous-function

 

window.gMapsCallback = function(){
    $(window).trigger('gMapsLoaded');
}

$(document).ready((function(){
    function initialize(){
        var mapOptions = {
            zoom: 8,
            center: new google.maps.LatLng(-34.397, 150.644),
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById('map_canvas'),mapOptions);
    }
    function loadGoogleMaps(){
        var script_tag = document.createElement('script');
        script_tag.setAttribute("type","text/javascript");
        script_tag.setAttribute("src","http://maps.google.com/maps/api/js?sensor=false&callback=gMapsCallback");
        (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
    }
    $(window).bind('gMapsLoaded', initialize);
    loadGoogleMaps();
})());

http://stackoverflow.com/questions/12601907/loading-google-maps-in-anonymous-function的更多相关文章

  1. Google maps API

    https://developers.google.com/kml/documentation/kml_tuthttps://developers.google.com/maps/documentat ...

  2. Google Maps API V3 之 图层

    Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...

  3. [Google Maps API 3]Marker从Clusterer中分离及Marker置于Cluster上一层的解决办法

    在Google Maps API的使用中,经常用到Clusterer来避免过密的Marker显示.但仔细看一下Clusterer的设置参数中并没有直接将某些Marker除外的方法,那遇到这样的需求,怎 ...

  4. Creating a Store Locator with PHP, MySQL & Google Maps(保存地图坐标 经纬度方法 google mysql)

    Google Geo APIs Team August 2009 This tutorial is intended for developers who are familiar with PHP/ ...

  5. 检索Google Maps地图位置(小训练)

    名称:检索地图位置 内容:地图初期显示和检索显示 功能:根据条件检索地图的经度与纬度 1.在这之前我们需要创建一个表(Accoun__c),添加一个重要的字段地理位置情報,它会默认的给你两个字段经度和 ...

  6. Google Maps API V3 之绘图库 信息窗口

    Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...

  7. Google Maps API V3 之 路线服务

    Google官方教程: Google 地图 API V3 使用入门 Google 地图 API V3 针对移动设备进行开发 Google 地图 API V3 之事件 Google 地图 API V3 ...

  8. Google Maps地图投影全解析(3):WKT形式表示

    update20090601:EPSG对该投影的编号设定为EPSG:3857,对应的WKT也发生了变化,下文不再修改,相对来说格式都是那样,可以到http://www.epsg-registry.or ...

  9. http://stackoverflow.com/questions/6065169/requestanimationframe-with-this-keyword

    Observe that you call obj.draw as : <button onclick="obj.draw() The first time obj.draw is c ...

随机推荐

  1. 爬虫学习----获取cookie

    http://blog.csdn.net/samxx8/article/details/21535901 1.获取cookie import urllib import http.cookiejarc ...

  2. csharp_ToJson的正确写法

    网上搜的,但有问题,已经改好...现在这个是正确的 public static string ToJson(DataTable dt, string jsonName)        {        ...

  3. ERP仓库管理系统查询(十)

    需求:    1.根据仓库编号,获取仓库信息绑定至页面相关控件. 2.根据仓库编号,获取管理员信息绑定到页面相关控件 修改的界面: <%@ Page Language="C#" ...

  4. 关于Android Studio里的Gradle,你所需要知道的都在这里了

    Gradle介绍 Gradle是一个先进的build toolkit,可以方便的管理依赖包和定义自己的build逻辑.到底有多先进,Android Studio官方集成Gradle,Google还专门 ...

  5. Android Material Design : Ripple Effect水波波纹荡漾的视觉交互设计

     Android Material Design : Ripple Effect水波波纹荡漾的视觉交互设计 Android Ripple Effect波纹荡漾效果,是Android Materia ...

  6. 求助 WPF ListViewItem样式问题

    求助 WPF ListViewItem样式问题 .NET 开发 > Windows Presentation Foundation Вопрос 0 Нужно войти <Style ...

  7. sql2008+vs2008安装心得以及详细教程分享

    第一步,我把原来装的vs2005+sql2005全部卸载了 第二步,下载VS2008同时下载sql2008: 第三步,开始安装VS2008专业版,网上有很多给出了微软的地址,在这里我也贴一个吧 htt ...

  8. Warning: Data truncated for column 'AirPress' at row 1

    /************************************************************************ * Warning: Data truncated ...

  9. IAP沙盒测试帐号无法购买的问题

    1,创建一个美国的iap测试帐号 2,啪的一声从哪个地方拔出你的ios设备,设置 -> Itunes Store和 App Store -> 点击Apple ID ->注销 3,运行 ...

  10. Link Aggregation and LACP with Open vSwitch

    In this post, I’m going to show you how to use link aggregation (via the Link Aggregation Control Pr ...