Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps InfoBox with click handlers and scrollbar
    primarykey
    data
    text
    <p>I have an application using the Google Maps javscript API and the Infobox plug-in (customizable version of the native InfoWindow).</p> <p>It was working fine until I had the following use-case: I need an Infobox with a scrollbar if the content is big, and it also needs to contain a couple of HTML elements with click listeners.</p> <p>What I usually have to do to support click handlers inside an infobox is to set enableEventPropagation= true, and use jQuery delegate to set the click handler. jQuery delegate does not work if I do not allow event propagation.</p> <p>This worked fine until I had to combine it with having a functioning scrollbar! What I have found is that the scrollbar will only work if I have enableEventPropagation= false, because if event propagation is enabled the drag event is just passed to the map and interpreted as panning. </p> <p>Does anyone know what I can do to both have a functioning scrollbar on the infobox content, and be able to set click handlers on some of the conent?</p> <p>To me it would sound logical that enableEventPropagation=false would solve both issues, since I don't understand why the click event needs to be propagated to the map in order to fire the handlers I attach to the html elements.</p> <p>This is the setup-object for my Infobox:</p> <pre><code>{ content: "[my html in here]", disableAutoPan: false, pixelOffset: new google.maps.Size(-77, 10), boxClass: "infoBox", infoBoxClearance: new google.maps.Size(18, 30), closeBoxMargin: "14px 6px", pane: "floatPane", enableEventPropagation: true }; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload