[OpenLayers-Users] problem with lightbox in openlayers

Maren Kiehl maren.kiehl at gmx.de
Thu Aug 20 17:11:23 EDT 2009


Hi at all,

I wrote an application in openlayers which shows popups whenever you 
click a point of my wfs in the map.
Now I want that a thumbnail is in this popup and when you click it the 
picture will be shown in the original size in a lightbox.
The thumbnail and the link to the picture are working perfectly but the 
browser doesn't show it in the lightbox but in a simple new 
browser-window. But why? I tried the lightbox in a simple html-file and 
there it works without a problem. Does openlayers disable it?

Here is my code:

<html>
    <head>  
    <link rel="stylesheet" href="includes/style.css" type="text/css" 
media="screen">
    <script src="../openl/lib/OpenLayers.js"></script>
    <script type="text/javascript" src="../lytebox/lytebox.js"></script>
    <script type="text/javascript">

        var map, selectControl, selectedFeature;
     
        function onPopupClose(evt) {
            selectControl.unselect(selectedFeature);
        }
       
        function onFeatureSelect(feature) {
 
            selectedFeature = feature;   
            popup = new OpenLayers.Popup("info",
                                     
feature.geometry.getBounds().getCenterLonLat(),
                                     new OpenLayers.Size(350,210),
                                     
"<html><h1>"+feature.attributes.Name+"</h1><b>Vergleich 
"+feature.attributes.Jahr+" & 2009:</b><br /><table width='330' 
height='100%' cellspacing='0' cellpadding='10'><tr><td valign='top'><a 
href='images/"+feature.attributes.Nick+".jpg' rel='lytebox' 
title='"+feature.attributes.Name+"'><img 
src='images/"+feature.attributes.Nick+"_thbn.jpg' 
border='0'></a></td><td 
valign='top'>"+feature.attributes.Info+"</td></tr></table></html>", 
false, onPopupClose);
           
            feature.popup = popup;
            map.addPopup(popup);        
        }
       
        function onFeatureUnselect(feature) {
            map.removePopup(feature.popup);
            feature.popup.destroy();
            feature.popup = null;
        }

---> after that the init()-function is programmed

It would be great if anybody could help me!!!

Thanks a lot!
Maren






More information about the Users mailing list