[Google Maps API v3] Re: Google maps in Drupal
That was the trick! When i changed the JQuery to getElementById it worked. Thank you all for helping me, i don´t think i ever would have figured that out. On 13 Apr, 01:38, William wrote: > On Apr 12, 4:52 pm, Macke wrote: > > > Hello William! > > > I tried to change the code but i still get the same message. I have > > used the same code on a ordinary .php file that has nothing to do with > > Drupal and then it works. > > If i try running the JQuery $('#map_canvas') after the page is loaded > > nothing gets selected > > $('#map_canvas') is a JQuery object, and $('#map_canvas')[0] is the > first DOM element matched by the selector (the map_canvas div) > > you are combining 3 different technologies: Google Maps, JQuery and > Drupal, so maybe try an example with just Google Maps and Drupal > without any JQuery. -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
[Google Maps API v3] Re: Google maps in Drupal
On Apr 12, 4:52 pm, Macke wrote: > Hello William! > > I tried to change the code but i still get the same message. I have > used the same code on a ordinary .php file that has nothing to do with > Drupal and then it works. > If i try running the JQuery $('#map_canvas') after the page is loaded > nothing gets selected $('#map_canvas') is a JQuery object, and $('#map_canvas')[0] is the first DOM element matched by the selector (the map_canvas div) you are combining 3 different technologies: Google Maps, JQuery and Drupal, so maybe try an example with just Google Maps and Drupal without any JQuery. -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
Re: [Google Maps API v3] Re: Google maps in Drupal
I think the jQuery selector always returns the jQuery object which the Google Maps API doesn't really know what to do with. This might be helpful. http://stackoverflow.com/questions/939036/using-jquery-selectors-within-google-map-does-not-work On Mon, Apr 12, 2010 at 11:18 AM, Chris Apolzon wrote: > I ran into an issue where I couldn't use the jquery selector object to > set the map variable. I was forced to fall back to > document.getElementById(). It was very odd because jquery had the > correct object, the google maps constructor just didn't like it. > > On Apr 12, 2:52 am, Macke wrote: > > Hello William! > > > > I tried to change the code but i still get the same message. I have > > used the same code on a ordinary .php file that has nothing to do with > > Drupal and then it works. > > If i try running the JQuery $('#map_canvas') after the page is loaded > > nothing gets selected if i change the code to $('div#map_canvas') on > > object get selected. But i still get the same error message when the $ > > ('div#map_canvas') is used. > > > > On 11 Apr, 09:21, William wrote: > > > > > > > > > On Apr 10, 8:32 pm, Macke wrote: > > > > > > map = new google.maps.Map(('#map_canvas'), mapOptions); > > > > > the error is using the jquery # selector without a reference to > > > jquery. > > > > > If you really want to use jquery for this, it would be: > > > > > map = new google.maps.Map($('#map_canvas')[0], mapOptions); > > > > > or instead use the usual getElementById function: > > > > > map = new google.maps.Map(document.getElementById('map_canvas'), > > > mapOptions); > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps JavaScript API v3" group. > To post to this group, send email to > google-maps-js-api...@googlegroups.com. > To unsubscribe from this group, send email to > google-maps-js-api-v3+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/google-maps-js-api-v3?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
[Google Maps API v3] Re: Google maps in Drupal
I ran into an issue where I couldn't use the jquery selector object to set the map variable. I was forced to fall back to document.getElementById(). It was very odd because jquery had the correct object, the google maps constructor just didn't like it. On Apr 12, 2:52 am, Macke wrote: > Hello William! > > I tried to change the code but i still get the same message. I have > used the same code on a ordinary .php file that has nothing to do with > Drupal and then it works. > If i try running the JQuery $('#map_canvas') after the page is loaded > nothing gets selected if i change the code to $('div#map_canvas') on > object get selected. But i still get the same error message when the $ > ('div#map_canvas') is used. > > On 11 Apr, 09:21, William wrote: > > > > > On Apr 10, 8:32 pm, Macke wrote: > > > > map = new google.maps.Map(('#map_canvas'), mapOptions); > > > the error is using the jquery # selector without a reference to > > jquery. > > > If you really want to use jquery for this, it would be: > > > map = new google.maps.Map($('#map_canvas')[0], mapOptions); > > > or instead use the usual getElementById function: > > > map = new google.maps.Map(document.getElementById('map_canvas'), > > mapOptions); -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
[Google Maps API v3] Re: Google maps in Drupal
Hello William! I tried to change the code but i still get the same message. I have used the same code on a ordinary .php file that has nothing to do with Drupal and then it works. If i try running the JQuery $('#map_canvas') after the page is loaded nothing gets selected if i change the code to $('div#map_canvas') on object get selected. But i still get the same error message when the $ ('div#map_canvas') is used. On 11 Apr, 09:21, William wrote: > On Apr 10, 8:32 pm, Macke wrote: > > > map = new google.maps.Map(('#map_canvas'), mapOptions); > > the error is using the jquery # selector without a reference to > jquery. > > If you really want to use jquery for this, it would be: > > map = new google.maps.Map($('#map_canvas')[0], mapOptions); > > or instead use the usual getElementById function: > > map = new google.maps.Map(document.getElementById('map_canvas'), > mapOptions); -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
[Google Maps API v3] Re: Google maps in Drupal
On Apr 10, 8:32 pm, Macke wrote: > map = new google.maps.Map(('#map_canvas'), mapOptions); the error is using the jquery # selector without a reference to jquery. If you really want to use jquery for this, it would be: map = new google.maps.Map($('#map_canvas')[0], mapOptions); or instead use the usual getElementById function: map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions); -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
[Google Maps API v3] Re: Google maps in Drupal
I have a working v3 map setup in drupal. Could you provide more detail about how you set it up? This is really beyond the scope of this group, so feel free to email me off the list. On Apr 9, 1:56 pm, Macke wrote: > Hello! > > I have been trying to create a module in Drupal that can show a google > map but i can't get it to work. I get the following error message: > > "uncaught exception: [Exception... "Could not convert JavaScript > argument arg 0 [nsIDOMViewCSS.getComputedStyle]" nsresult: "0x80570009 > (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame > ::http://maps.gstatic.com/intl/sv_se/mapfiles/api-3/0/36/main.js:: > nj :: line 33" data: no]" > > I would appreciate some help with this, i have no idea what the > problem is. -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
[Google Maps API v3] Re: Google maps in Drupal
Unfortunatly i can't, i am running the site on a localhost. But i can paste the code of what i have done. I have the following pice of code in a .js file that i have included in my theme: - var map; var markersArray = []; function initialize() { var haightAshbury = new google.maps.LatLng(37.7699298, -122.4469157); var mapOptions = { zoom: 12, center: haightAshbury, mapTypeId: google.maps.MapTypeId.TERRAIN }; map = new google.maps.Map(('#map_canvas'), mapOptions); google.maps.event.addListener(map, 'click', function(event) { addMarker(event.latLng); }); } $(document).ready(initialize); --- My .module file that is suppose to contain the map looks like this: --- http://maps.google.com/maps/api/js?sensor=false";> '); $block = array(); $block['subject'] = t('Map'); $block['content'] = ""; return $block; } } - I hope this can make things a bit clearer. I am greatful for all help i can get. Sincerely, Markus On 9 Apr, 20:49, Luke Mahé wrote: > Would you be able to supply a link to your example? > > Thanks > Luke > > > > On Fri, Apr 9, 2010 at 10:56 AM, Macke wrote: > > Hello! > > > I have been trying to create a module in Drupal that can show a google > > map but i can't get it to work. I get the following error message: > > > "uncaught exception: [Exception... "Could not convert JavaScript > > argument arg 0 [nsIDOMViewCSS.getComputedStyle]" nsresult: "0x80570009 > > (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: > >http://maps.gstatic.com/intl/sv_se/mapfiles/api-3/0/36/main.js:: > > nj :: line 33" data: no]" > > > I would appreciate some help with this, i have no idea what the > > problem is. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Maps JavaScript API v3" group. > > To post to this group, send email to > > google-maps-js-api...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-maps-js-api-v3+unsubscr...@googlegroups.com > > . > > For more options, visit this group at > >http://groups.google.com/group/google-maps-js-api-v3?hl=en.- Dölj citerad > >text - > > - Visa citerad text - -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.