map - Images' size in Leaflet (Cloudmade) popups don't seem to count to determine popup's size -



i'm having hard time getting around problem came across while using leaflet's library on mapbox map. specifically, i've written code popup bind each icon/marker on map. inside each popup there's image links different website. unfortunately seems image's size doesn't count towards calculation of size of actual popup, having following consecuences:

my code following:

    <?php       // retrieves info correct rows in database 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 think of possible solution this? i'm afraid i'm quite beginner when in comes programming, it's been many days without being able crack one. appreciate help! thank much!

creating new element via dom , using content of popup in bindpopup() worked me when had problems this.

although not documented @ source code reveals method can take dom node content, instead of string containing markup.

using method resulted in popup being sized correctly when clicked.

example:

var divnode = document.createelement('div'); divnode.innerhtml = '<p>my custom html <img src="..." /></p>'; marker.bindpopup(divnode); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -