Google Maps mashup with animated DHTML markers and infoboxes, YUI contributes
February 28th, 2008Back in November, Family Travel relaunched with a ton of new content, a completely new look & feel, and great Google Maps integration.
I’m the dummy who told the client that animated markers and infoboxes would be OK, and I’m the dummy who had to code it (the javascript) in under two months, by myself. To be honest, the launch was a little glitchy. Now, though, things seem to be running pretty smoothly.
As far as I know, Family Travel is the first and only site to have animated DHTML markers and infoboxes. We probably could have accomplished the feat in Flash, but I was not comfortable with the general state of Flash integration with Google Maps. Even in the months since I began coding the project in Javascript, that arena has gotten stronger, though I’d still call it “experimental” for advanced applications.
Speaking of experiments, while the Google Maps application and its API are pretty well-tested, I was definitely treading some new ground. Also, I found the documentation to be lacking in some instances; for instance, it’s not always explicit what type of object is required as a parameter and what type of object is returned (in some cases, a class will be referred to by two or more names throughout the documentation - not helpful!). One possible bug I found was that the ‘disableDragging’ method doesn’t always ’stick’. Perhaps all of my animation and GOverlay hacking was confusing the map, but dragging definitely enables at times that I don’t want it to, and at times when I’m definitely not calling the ‘enableDragging’ method. I’ve unfortunately overcome this with a ‘dontDragDaemon’, which makes sure dragging stays disabled when it needs to.
First of all, the GMarker class and GInfoWindow class simply don’t support animation. That was a big deal to overcome. I wound up completely re-implementing both concepts according to the GOverlay interface, which worked out well. However, I found some of the behavior of GOverlay to be downright unpredictable. The ‘force’ parameter to the redraw function seemed to be passed ‘true’ more than I wanted it to, so I had to manage that largely on my own. Inside my info windows, Flash movies sometimes play. In Safari, mouse interaction with the Flash did not work at all. I suspect it had something to do with the ‘pane’ architecture of the map, but after much head scratching, I decided to take the Flash out of the map, and merely position it on top of the map.
Here are two great examples of the map in action. Unfortunately, the feature is a bit hidden. Click ‘Map It’ to bring up the map. Comments and bug reports are encouraged:
There’s also a small version on the map, used on another type of page (down the right side):
All of the animation and event handling was done using YUI, a library for which I only become more fond as time goes on. The documentation is perfect, once you find your way around. I may write another article just to fully proclaim my love for YUI…




