I found that the svn infobox js is different than the html example. I
prefer the js that was in the html version. I appended the InfoBox
function to include the opts.html, so that it is easier to work with.
(basically a hybrid of the checked in js, and the html)
function InfoBox(opts) {
google.maps.OverlayView.call(this);
this.latlng_ = opts.latlng;
this.map_ = opts.map;
this.html_ = opts.html;
this.offsetVertical_ = -195;
this.offsetHorizontal_ = 0;
this.height_ = 165;
this.width_ = 266;
var me = this;
this.boundsChangedListener_ =
google.maps.event.addListener(this.map_, "bounds_changed", function
() {
return me.panMap.apply(me);
});
// Once the properties of this OverlayView are initialized, set its
map so
// that we can display it. This will trigger calls to panes_changed
and
// draw.
this.set_map(this.map_);
}
then line 84 becomes: contentDiv.innerHTML = this.html_;
Then it is easier to execute in my opinion than the InfoBox
(latlng,map,opts) version where you have more confusion and bits of
overhead.
In HTML:
var iWindowHTML = '<div id="wrap_div">'+
'<div class="tTitle">'+
'<h3 class="mainTitle">your title</h3>'+
'<div class="cur_place">icon_or_something</div>'+
'</div>'+
'<div class="main-content">'+
'your contents'+
'</div>'+
'</div>';
google.maps.event.addListener(team, 'click', function(e) {
var infoBox = new InfoBox({latlng: team.get_position(), map:map, html:
iWindowHTML});
});
----------
What I found really nice about this approach is that you can
completely kill the need to run a predetermined infoBox background,
you can specify everything as simple DOM and css and you render your
infoBox even quicker!
I am making a Facebook application (currently in private alpha) that
needed to be able to think quickly and run in a completely dynamic
environment so the approach provided by Esa (infobox.js) and a little
hack to simplify the code was the perfect solution. Think about using
Ajax to call the contents of iWindowHTML, return and display that info
within the box. The solution is then extremely light weight. I will
upload my rev code in a little bit.
Cheers,
Scott Haines
Newfront Creative
On Sep 7, 12:25 pm, Scott Haines <
sc...@newfrontproductions.com>
wrote: