---
OpenLayers.Popup.FramedCloud.prototype.autoSize = false;
// ここから今までのスクリプトを修正します。
AutoSizePopup = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {
autoSize: true,
maxSize: new OpenLayers.Size(150,150)
});
var markers = new OpenLayers.Layer.Markers("Marker");
map.addLayer(markers);
addMarkers();
function addMarkers(){
var ll, popupClass, popupContentHTML;
ll = new OpenLayers.LonLat(-26000, -74000);
popupClass = AutoSizePopup;
popupContentHTML = "<img src='./mapsign/tatsu2.png' width='150px' height='150px'></img>";
addMarker(ll, popupClass, popupContentHTML, true);
ll = new OpenLayers.LonLat(-27000, -75000);
popupClass = AutoSizePopup;
popupContentHTML = "<img src='./mapsign/36.gif' width='32px' height='32px'></img>";
addMarker(ll, popupClass, popupContentHTML, true);
ll = new OpenLayers.LonLat(-25000, -73000);
popupClass = AutoSizePopup;
popupContentHTML = "<img src='./mapsign/35.gif' width='32px' height='32px'></img>";
addMarker(ll, popupClass, popupContentHTML, true);
}
function addMarker(ll, popupClass, popupContentHTML, overflow) {
var feature = new OpenLayers.Feature(markers, ll);
feature.popupClass = popupClass;
feature.data.popupContentHTML = popupContentHTML;
feature.data.overflow = (overflow) ? "auto" : "hidden";
var marker = feature.createMarker();
markers.addMarker(marker);
marker.events.register("mousedown", feature, mousedown);
function mousedown(evt) {
if (this.popup == null) {
this.popup = this.createPopup(true);
map.addPopup(this.popup);
this.popup.show();
} else {
this.popup.toggle();
}
currentPopup = this.popup;
OpenLayers.Event.stop(evt);
}
} //function init() の最後
2008年11月17日月曜日
OpenLyaers 16h Popupを複数表示
複数のマーカーを配置してみます。
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿