Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
var info = new PlaceInfowin(latlng, place); this._map.addOverlay(info);
function PlaceInfowin(latlng, place){
this.prototype = new GOverlay();
var html = "hello" // сюда кладем html содержимого окошка
this.initialize = function(map) {
var div = $('<div />');
this.map_ = map;
this.div_ = div;
div.css({
position : 'absolute',
}).appendTo(map.getPane(G_MAP_FLOAT_PANE)); // здесь вносим наш div на карту
this.update(html); // рисуем наш infowin либо просто обновляем содержимое div
};
this.update = function(html){
this.html_ = html;
this.div_.empty();
var content = $('<div/>').addClass('content').css({
'position' : 'relative',
'overflow' : 'hidden',
'top' : 5,
'left' : 5,
'right' : 5,
'bottom' : 5,
'height' : 120,
'width' : 150,
}).html(html);
$('<div />').css({
'background-color' : 'grey',
'height' : 120,
'width' : 150,
'padding': '2px 2px 2px 2px',
'border-width': '2px',
'border-style': 'solid',
'border-color': 'black'
}).html(content).appendTo(this.div_);
this.redraw(true); // здесь div будет расположен в нужном месте на карте
};
this.redraw = function(force) {
if (!force) return;
var point = this.map_.fromLatLngToDivPixel(this.latlng_);
this.div_.css({
left : point.x,
top : point.y - this.div_.height() - 30
});
};
// функция удаление div с карты
this.remove = function() {
this.div_.remove();
};
// копирование
this.copy = function() {
return new PlaceInfowin(this.latlng_,
this.place_);
};
};


История одного сайта или как мы за месяц сделали приложение на Google Maps