NickT
NickT

Reputation: 421

Google Maps: How does Trulia create their custom InfoWIndows?

I really like how Trulia.com has created their custom Google Map InfoWindows.

What I like in particular about Trulia's implementation of the InfoWindow is:

I found the PdMarker, which is a 3rd party extension for Google Map InfoWindows that accomplishes most of the above bullets but not all. 1) It does not extend beyond the map border, 2) it does not work with Google Maps API version 3 (only version 2).

Anyone know how Trulia is accomplishing their InfoWindow-like implementation on Google Maps API v3?

Upvotes: 1

Views: 6580

Answers (2)

Dizzy Bryan High
Dizzy Bryan High

Reputation: 2061

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/examples.html

is an extension to google maps which allows you to create custom infowindows

Upvotes: 3

armandino
armandino

Reputation: 18548

That's an interesting question. I've been playing with maps recently too. I'm far from expert but I can tell you what I know.

I think the site you mentioned uses a custom div overlay rather than google's info window.

1. InfoWindow is displayed on mouse hover (not 'click')

This can be done with event listeners. For example in maps API v3:

google.maps.event.addListener(marker, 'mouseover', function() {
   // myDiv.style.visibility = 'visible'
});
google.maps.event.addListener(marker, 'mouseout', function() {
  // myDiv.style.visibility = 'hidden'
});

Here's is a pretty good example of how this can be done.

2. Extends beyond the map border
3. Always displays InfoWindow near map Center

Both of these can be achieved using CSS: (2) using z-index and (3) with position.

There is a similar example of using custom marker tooltips which you can find here. It also shows how you can utilize mouseovers to pop-up tooltips by hovering other elements on your page.

myElement.onmouseover = function(){
  google.maps.event.trigger(marker, 'mouseover');
}
myElement.onmouseout = function(){
  google.maps.event.trigger(marker, 'mouseout');
}

Finally, another site that makes a good use of maps, although this one uses V2 of the API. Hope this helps.

Upvotes: 4

Related Questions