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. simtrace之探秘SIM卡中的世界

    0×00 关于SIM卡 众所周知SIM卡是一张插在手机上的小卡,其全称为Subscriber Identity Module 客户识别模块.不过,这个世界上并没有多少人知道SIM卡中的操作系统是基于j ...

  2. 进行以上Java编译的时候,出现unmappable character for encoding GBK。

    public class Exerc02{ public static void main(String args []){ char c = '中国人'; System.out.pingtln(c) ...

  3. Qemu文档

    http://wiki.qemu.org/Manual http://qemu.weilnetz.de/qemu-doc.html http://www.linuxcertif.com/man/1/q ...

  4. Linux学习之CentOS--FTP服务原理及vsfptd的安装、配置

    本篇随笔将讲解FTP服务的原理以及vsfptd这个最常用的FTP服务程序的安装与配置... 一.FTP服务原理 FTP(File Transfer Protocol)是一个非常古老并且应用十分广泛的文 ...

  5. 重学STM32---(十) ——CAN通信(二)

    CAN协议是非常难的,但是在stm32中却是简单的,只需要我们配置寄存器即可,,,即使这样,我在学习的时候也遇到了许多困难 1.开时钟,不用说 2.设置GPIO口,,CAN_TX复用推挽输出,CAN_ ...

  6. buildroot httpd php

    /******************************************************************** * buildroot httpd php * 说明: * ...

  7. Aborting commit: 'XXXXXXXX'remains in conflict错误

    今天在提交项目文件到本地SVN时提示错误如下: 过期:”global.php“在事务”21-1“, You have to update your working copy first. 运行upda ...

  8. Hashing filters for very fast massive filtering

    If you have a need for thousands of rules, for example if you have a lot of clients or computers, al ...

  9. How to migrate from VMware and Hyper-V to OpenStack

    Introduction I migrated >120 VMware virtual machines (Linux and Windows) from VMware ESXi to Open ...

  10. 我看的公开课系列--《TED:对无知的追求》 by stuart firestein

    http://open.sina.com.cn/course/id_1047/ What scientists do is not just collect data and collect fact ...