I find it difficult to overcome the problem that I encountered using the Leaflet library on the Mapbox. In particular, I wrote the code so that the pop-up window would be associated with each icon / marker on the map. Inside each popup there is an image that links to another website. Unfortunately, it seems that this image size is not taken into account when calculating the size of the actual pop-up window having the following consecuences:
My code is as follows:
<?php // Retrieves info from all correct rows in database to further input in javascript while ($row = mysql_fetch_assoc($get_info)){ $name = $row ['nombre']; $lat = $row ['lat']; $long = $row ['long']; echo "<script type=\"text/javascript\"> var latlng = new L.LatLng(".$row ['lat'].", ".$row ['long']."); var flyer = \"<a href='boliches/pdnws/".$row ['nombre'].".php'><img src='boliches/flyers/".$day."/".$row ['nombre'].".jpg'/></a>\"; var MyIcon = L.Icon.extend({ iconUrl: 'boliches/icons/".$row ['nombre'].".png', shadowUrl: null, iconSize: new L.Point(50, 50), shadowSize: null, iconAnchor: new L.Point(25, 25), popupAnchor: new L.Point(1, 1) }); var icon = new MyIcon(); var marker = new L.Marker(latlng, {icon: icon}); map.addLayer(marker); marker.bindPopup(flyer, {maxWidth:800, autoPan:true}); </script>"; } ?>
Can you think of a possible solution to this? I'm afraid that I start to start when programming comes, but there were too many days without being able to crack this one. I really appreciate your help! Thank you very much!
source share