Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8654439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:47:18+00:00 2026-06-12T14:47:18+00:00

I’m having a hard time getting around a problem I came across while using

  • 0

I’m having a hard time getting around a problem I came across while using Leaflet’s library on a Mapbox map. Specifically, I’ve written the code so that a popup is bind to each icon/marker on the map. Inside each popup there’s an image that links to a different website. Unfortunately it seems that this image’s size doesn’t count towards the calculation of the size of the actual popup, having the following consecuences:

  • the image is much bigger than the popup ( http://postimage.org/image/c7u0n5sx3/ )
  • the autoPan option does’t work

My code is the following:

    <?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 I’m quite a beginner when in comes to programming, but it’s been too many days without being able to crack this one. I really appreciate your help! Thank you so much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:47:19+00:00Added an answer on June 12, 2026 at 2:47 pm

    Creating a new element via the Dom and using that as the content of the popup in bindPopup() worked for me when I had problems with this.

    Although not documented a look at the source code reveals that this method can take a Dom node as the content, instead of a string containing the markup.

    Using this method resulted in the popup being sized correctly when clicked.

    Example:

    var divNode = document.createElement('DIV');
    divNode.innerHTML = '<p>My custom HTML <img src="..." /></p>';
    marker.bindPopup(divNode);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I've tracked down a weird MySQL problem to the two different ways I was
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.