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. 超级链接a+ confirm用法

    示例: <a href="DelServlet?action=${fuwa.id}" onClick="return confirm('你确定要删除?')" ...

  2. Java 集合深入理解(13):Stack 栈

    点击查看 Java 集合框架深入理解 系列, - ( ゜- ゜)つロ 乾杯~ 今天心情不错,再来一篇 Stack ! 数据结构中的 栈 数据结构中,栈是一种线性数据结构,遵从 LIFO(后进先出)的操 ...

  3. css制作三角形

    #triangle-up { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid tr ...

  4. GitHub for Windows

    /*************************************************************************** * GitHub for Windows * ...

  5. 【avalon源码】

    1. document.getElementsByTagName('head')[0] document.head 2. 3. var IEVersion = NaN if (window.VBArr ...

  6. 一个for列出横纵坐标

    h = i % * hCount; v = Math.floor(i / hCount);

  7. 【转】使用cocos2d-console工具转换脚本为字节码

    从Cocos2D-X v2.1.4版本开始,增加了Cocos2D-console命令行工具,该工具的其中一个功能是:把.js文件转换为.jsc文件,该文件是字节码格式,可以提高代码的安全性. 使用这个 ...

  8. CentOS安装Xen

    1.服务器环境及Xen版本: CentOS 5.4 64bit Xen-3.4.3,已经自带安装包 2.自制本地yum源: 安装httpd,指向本地xen yum源 3.修改yum.repo使其指向本 ...

  9. GFF format

    后记: ************************************************************************ 在使用cufflinks和cuffmerge中 ...

  10. 安装GD库解决ThinkPHP 验证码Call to undefined function Think\imagecreate()出错

    在php中imagecreate函数是一个图形处理函数,主要用于新建一个基于调色板的图像了,然后在这个基础上我们可以创建一些图形数字字符之类的,但这个函数需要GD库支持,如果没有开启GD库使用时会提示 ...