Re: google maps not showing correctly

29 views
Skip to first unread message

Sean Montgomery

unread,
Feb 25, 2012, 12:59:30 PM2/25/12
to Ben Turner, Phil Groman, mobileweb...@nyu.edu
Good question Ben. I'm cc-the class.

I struggled with that one for a good long while on an app I was making. When you change the size of the div containing the google map, or show and hide the div, you should call:
google.maps.event.trigger(gMap, 'resize');

Some links:

If you want to get fancy, you could even add an event listener. Here's one in jquery:

Sean


On Fri, Feb 24, 2012 at 4:39 PM, Ben Turner <exte...@benturner.com> wrote:
Prof. Montgomery,

Phil and I are having difficulty with Google Maps not loading correctly into a DIV.  It appears as though there's a problem with Google Maps not setting itself in the right position within the DIV, so half of the map data appears as gray.


index.html is loading js/custom.js.

We've spent a ton of time trying to figure this one out, including re-triggering the map so it'd resize, but we can't get it to work.  Ideas?


-Ben

Ben Turner

unread,
Feb 27, 2012, 12:26:40 PM2/27/12
to mobileweb...@nyu.edu
We ended up working around the problem by calling the resize event every time the button link to that page is clicked. (we have all the "pages" in one index.html document)  Now the map loads partially at first, but is resized quickly afterwards.  It sort of works!

But there's still some wacky layout/DIV/design bug in there, I think.  Hoping this won't cause more problems once we start adding location markers and other things depending on the map rendering correctly.

We are also experiencing very stop-and-go scrolling.  I'm not sure if this is because of jQuery Mobile + Ice Cream Sandwich or what (that's how I'm testing it), but is anyone else having less-than-smooth scrolling in their phone apps?


-Ben
Reply all
Reply to author
Forward
0 new messages