Note that there are some explanatory texts on larger screens.

plurals
  1. POInitializing a Google Map With jQuery
    primarykey
    data
    text
    <p>I am just starting out with Google Maps API v3 and jQuery. I have made maps before with the v2 API, but it didn't use jQuery. This way will hopefully help me learn some more jQuery on the way. I am following the example on the <a href="https://developers.google.com/maps/documentation/javascript/tutorial" rel="nofollow">Google Maps API Tutorial</a> and trying to get their most basic hello world work with jQuery. I am also using the <a href="http://gmapvsdoc.codeplex.com/" rel="nofollow">Google Maps API3 Visual Studio Intellisense helper</a>.</p> <p>My main page is as follows:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;Map Page&lt;/title&gt; &lt;link href="style/main.css" rel="stylesheet" /&gt; &lt;script src="scripts/jquery-1.10.2.js"&gt;&lt;/script&gt; &lt;script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="scripts/google-maps-3-vs-1-0.js"&gt;&lt;/script&gt; &lt;script src="scripts/mdaMap.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function () { map = new google.maps.Map($("#map-canvas"), startMapOptions); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="map-canvas" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>mdaMap.js contain's the following:</p> <pre><code>/// &lt;reference path="jquery-1.10.2.js" /&gt; /// &lt;reference path="google-maps-3-vs-1-0.js" /&gt; var map; var startMapOptions = new google.maps.MapOptions; var startCenterLocation = new google.maps.LatLng(32.912229, -88.692627); var startZoomLevel = 7; var startMapTypeId = google.maps.MapTypeId.ROADMAP; </code></pre> <p>I'm trying to get this working with just some basic jQuery to load the map into a specific element, rather than using Google's tutorial code of <code>google.maps.event.addDomListener(window, 'load', initialize);</code></p> <p>What is it I am missing? My jQuery knowledge is limited, but I thought I at least knew how to do selectors and have script run when the page was ready with <code>$(function() {})'</code></p> <p>Or is my mistake in thinking that a map can be initialized other than the above mentioned way with <code>addDomListener</code>?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload