我目前正在设计一个广泛使用openlayers的网站。地图上放置了各种矢量标记,当用户单击标记时,会出现一个弹出窗口。在这个弹出窗口中有一些图片已经设置为灯箱。唯一的问题是当单击缩略图时图像在新窗口中打开(即,没有通过Lightbox为事件识别链接)。灯箱的html非常好,因为我已经在弹出窗口之外对它进行了测试。OpenLayers PopUp的Lightbox Gallery
我想有lightbox在弹出窗口工作,任何帮助将不胜感激。 这里是我的代码:
弹出创建:从Lightbox.js
关于点击收听
function onFeatureSelect(feature) {
selectedFeature = feature;
popup = new OpenLayers.Popup.AnchoredBubble("PopUp",
feature.geometry.getBounds().getCenterLonLat(),
null,
null,
null, true, onPopupClose);
popup.setContentHTML('<div><a href="large_image.png" rel="lightbox"><img src="thumb_image.png" /></a></div>');
feature.popup = popup;
map.addPopup(popup);
}
摘录:
updateImageList: function() {
this.updateImageList = Prototype.emptyFunction;
document.observe('click', (function(event){
var target = event.findElement('a[rel^=lightbox]') || event.findElement('area[rel^=lightbox]');
if (target) {
event.stop();
this.start(target);
}
}).bind(this));
},
感谢您的阅读。任何帮助将不胜感激。